and new link too 2011/8/21 Roberto Perdomo <roberto...@gmail.com>
> Great work, thanks > > I just wanted to make a suggestion, you can place the links to to view and > edit as modal windows , and when close it, reload the table page? > > > > 2011/8/21 mart <msenecal...@gmail.com> > >> Hi Massimo, >> >> So all is working great! I just have one question :) >> >> i think I am making a real mess of things while trying to add an xtra >> link. >> >> this is in my test controller function: >> >> def test() >> table=SQLFORM.grid(db.buildSpec,links=[lambda >> r:A('build',_href=(f=queue_it ... --> the rest is way to ugly to >> show ;) >> >> return dict(table=table) >> >> >> which should call this function when the link is clicked: >> >> def queue_it(): >> Q=os.path.abspath('../../../Q') >> id=request.args(2) >> >> name=db(db[request.args(1)].id==id).select()\ >> .last().name >> >> content=db(db[request.args(1)].id==id).select()\ >> .last().content >> >> client_system=db(db[request.args(1)].id==id).select()\ >> .last().client_system >> >> change=db(db[request.args(1)].id==id).select()\ >> .last().change >> >> changed_by=db(db[request.args(1)].id==id).select()\ >> .last().changed_by >> >> date=db(db[request.args(1)].id==id).select()\ >> .last().date >> >> description=db(db[request.args(1)].id==id).select()\ >> .last().description >> >> is_head=db(db[request.args(1)].id==id).select()\ >> .last().is_head >> >> if os.path.exists(Q): >> bsPath='{0}/{1}'.format(Q,name) >> if os.path.exists(bsPath): >> try: >> os.remove(bsPath) >> except Exception as err: >> print('could not remove existing file >> {0}\n{1}'.format(bsPath,err)) >> >> oFile=open(bsPath,'a') >> for cItem in content.split('\n'): >> if '<build' in cItem: >> cItem='{0}\n\t\tbuildSpec_id="{1}"'.format(cItem,id) >> oFile.write('{0}\n'.format(cItem)) >> oFile.close() >> >> response.flash='{0} has been dropped in the blueLite Q'\ >> .format(name) >> >> return dict(form=crud()\ >> ,name=name\ >> ,client_system=client_system\ >> ,change=change\ >> ,changed_by=changed_by\ >> ,date=date\ >> ,description=description\ >> ,is_head=is_head) >> >> >> any help would be appreciated (and sorry for the dumb question :) ), >> Thanks, >> Mart :) >> >> On Aug 19, 12:28 pm, Richard Vézina <ml.richard.vez...@gmail.com> >> wrote: >> > ;-D >> > >> > Think we will be needing a recent advance briefing email througth the >> > list... >> > >> > Richard >> > >> > On Fri, Aug 19, 2011 at 5:57 AM, Martín Mulone <mulone.mar...@gmail.com >> >wrote: >> > >> > >> > >> > >> > >> > >> > >> > > The web2py is advancing so fast, that the documentation get deprecated >> > > before get published. :) >> > >> > > 2011/8/18 Massimo Di Pierro <massimo.dipie...@gmail.com> >> > >> > >> Actually I just killed myself in the foot... I am writing a packt >> book >> > >> with some other members of the list. Have to deliver it in 5 days. >> > >> Today 10-20% of the book recipes become obsolete and I have to >> rewrite >> > >> them. At the same time I am not ready to commit to the API of the new >> > >> SQLFORM.grid. :-( >> > >> > >> On Aug 18, 6:32 pm, mart <msenecal...@gmail.com> wrote: >> > >> > WOW! Thank you! this is awesome!!!!! :) >> > >> > >> > Mart :) >> > >> > >> > On Aug 18, 5:03 pm, Massimo Di Pierro <massimo.dipie...@gmail.com> >> > >> > wrote: >> > >> > >> > > This is a new API so it expects a new syntax for represent that >> takes >> > >> > > two arguments. The second argument is the record. >> > >> > >> > > On Aug 18, 2:47 pm, pbreit <pbreitenb...@gmail.com> wrote: >> > >> > >> > > > I'm getting errors on my tables. auth_user works OK but I get >> these >> > >> errors >> > >> > > > on three of my other tables. >> > >> > >> > > > Traceback (most recent call last): >> > >> > > > File "/Users/pbreit/web2py/gluon/restricted.py", line 194, in >> > >> restricted >> > >> > > > exec ccode in environment >> > >> > > > File >> > >> "/Users/pbreit/web2py/applications/init/controllers/default.py" < >> > >> >> http://pb-dev.pricetack.com:8001/admin/edit/init/controllers/default.py>, >> > >> line 107, in <module> >> > >> > > > File "/Users/pbreit/web2py/gluon/globals.py", line 145, in >> > >> <lambda> >> > >> > > > self._caller = lambda f: f() >> > >> > > > File >> > >> "/Users/pbreit/web2py/applications/init/controllers/default.py" < >> > >> >> http://pb-dev.pricetack.com:8001/admin/edit/init/controllers/default.py>, >> > >> line 12, in grid >> > >> > > > table = SQLFORM.grid(db.purchase) >> > >> > > > File "/Users/pbreit/web2py/gluon/sqlhtml.py", line 1408, in >> grid >> > >> > > > value=field.represent(value,row) >> > >> > > > File "/Users/pbreit/web2py/gluon/dal.py", line 3730, in >> repr_ref >> > >> > > > def repr_ref(id, r=referenced, f=ff): return f(r, id) >> > >> > > > File "/Users/pbreit/web2py/gluon/dal.py", line 3699, in ff >> > >> > > > row=r(id) >> > >> > > > File "/Users/pbreit/web2py/gluon/dal.py", line 3805, in >> __call__ >> > >> > > > return self.__getitem__(key) >> > >> > > > File "/Users/pbreit/web2py/gluon/dal.py", line 3802, in >> > >> __getitem__ >> > >> > > > return dict.__getitem__(self, key) >> > >> > > > KeyError: '1' >> > >> > >> > > > Traceback (most recent call last): >> > >> > > > File "/Users/pbreit/web2py/gluon/restricted.py", line 194, in >> > >> restricted >> > >> > > > exec ccode in environment >> > >> > > > File >> > >> "/Users/pbreit/web2py/applications/init/controllers/default.py" < >> > >> >> http://pb-dev.pricetack.com:8001/admin/edit/init/controllers/default.py>, >> > >> line 107, in <module> >> > >> > > > File "/Users/pbreit/web2py/gluon/globals.py", line 145, in >> > >> <lambda> >> > >> > > > self._caller = lambda f: f() >> > >> > > > File >> > >> "/Users/pbreit/web2py/applications/init/controllers/default.py" < >> > >> >> http://pb-dev.pricetack.com:8001/admin/edit/init/controllers/default.py>, >> > >> line 12, in grid >> > >> > > > table = SQLFORM.grid(db.item) >> > >> > > > File "/Users/pbreit/web2py/gluon/sqlhtml.py", line 1408, in >> grid >> > >> > > > value=field.represent(value,row) >> > >> > > > TypeError: <lambda>() takes exactly 1 argument (2 given) >> > >> > > -- >> > > http://martin.tecnodoc.com.ar >> > >