sorry, you are right; this is the request: def provvedimenti_insert(): id=request.args[1] linkto=URL(r=request,c='gestione',f='update',vars=dict (refereer=request.env.path_info)) nomin=db(db.nominativi.id==id).select() provv=db(db.provvedimenti.nominativi_id==id).select (orderby=~db.provvedimenti.data) nominativi=SQLTABLE(nomin,_class='sortable',headers=headers) provvedimenti=SQLTABLE (provv,linkto,_class='sortable',headers=headers) return dict(nominativi=nominativi,provvedimenti=provvedimenti,id=id)
and in the function update, the line that begins with if len (request.args)<2 ... is line 230: def update(): if len(request.args)<2 or not request.args[0] in db.tables: table=request.args[0] else: id=int(request.args[1]) records=db(db[table].id==request.args[1]).select() if not records: session.flash=T('record does not exist') redirect(URL(r=request,f='select',args=[table])) else: record=records[0] form=SQLFORM(db[table],record,deletable=True, linkto=URL (r=request,f='select'), upload=URL(r=request,f='download'), hidden=dict(refereer=request.vars.back)) if form.accepts(request.vars,session): response.flash=T('done!') redirect(request.vars.refereer) return dict(form=form) Paolo On 5 Dic, 16:13, mdipierro <[EMAIL PROTECTED]> wrote: > I cannot say which one line is 230 without the entire app. > It may help if you print request > > On Dec 5, 2:35 am, pmate <[EMAIL PROTECTED]> wrote: > > > Massimo, it keeps not working. This is the error it gives when i call > > the update function: > > Error traceback > > Traceback (most recent call last): > > File "gluon\restricted.pyc", line 62, in restricted > > File "C:\...\myapp/controllers/gestione.py", line 255, in <module> > > File "gluon\globals.pyc", line 55, in <lambda> > > File "C:\...\myapp/controllers/gestione.py", line 230, in update > > IndexError: list index out of range > > > i think it is some kind of problem with request.args[] in update > > function > > > Paolo > > > On 4 Dic, 15:40, mdipierro <[EMAIL PROTECTED]> wrote: > > > > Try this: > > > > > def update(): > > > > if len(request.args)<2 or not request.args[0] in db.tables: > > > > table=request.args[0] > > > > else: > > > > id=int(request.args[1]) > > > > records=db(db[table].id==request.args[1]).select() > > > > if not records: > > > > session.flash=T('record does not exist') > > > > redirect(URL(r=request,f='select',args=[table])) > > > > else: record=records[0] > > > > form=SQLFORM(db[table],record,deletable=True, > > > > linkto=URL(r=request,f='select'), > > > > upload=URL(r=request,f='download'), > > > > hidden=dict(refereer=request.vars.back or > > > > 'some/where/else')) > > > > if form.accepts(request.vars,session): > > > > response.flash=T('done!') > > > > redirect(request.vars.refereer) > > > > return dict(form=form) > > > > > this is the calling action in controller default.py: > > > > > @t2.requires_login(next='login') > > > > def provvedimenti_insert(): > > > > id=request.args[0] > > > > > > > > linkto=URL(r=request,c='gestione',f='update',vars=dict(refereer=request.path.info)) > > > > nomin=db(db.nominativi.id==id).select() > > > > > > > > provv=db(db.provvedimenti.nominativi_id==id).select(orderby=~db.provvedimenti.data) > > > > nominativi=SQLTABLE(nomin,_class='sortable',headers=headers) > > > > > > > > provvedimenti=SQLTABLE(provv,linkto,_class='sortable',headers=headers) > > > > return > > > > dict(nominativi=nominativi,provvedimenti=provvedimenti,id=id) > > > > No more .../db/... in the urls. > > > > Massimo > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---