Somehow one of your variables does not contain what you expect. Try
logging them:

@auth.requires_login()
def edit():
  print request.vars['tbl'], request.vars['id']
  form_edit = crud.update(db[request.vars['tbl']],
request.vars['id'])

what do you see?

On Mar 4, 9:10 am, kachna <[email protected]> wrote:
> Hi all,
> I use CRUD.update to generate update form. After submit this form a
> receive:
>
> TypeError: list indices must be integers, not str
>
> MODEL:
>
> db.define_table('runner',
>   Field('name','string'),
>   Field('male','integer',requires=IS_INT_IN_RANGE(0, 2))
> )
>
> CONTROLLER:
>
> @auth.requires_login()
> def edit():
>   form_edit = crud.update(db[request.vars['tbl']], request.vars['id'])
>
>   return dict(form=form_edit)
>
> COMPLETE ERROR:
> Traceback (most recent call last):
>   File "/home/kachna/work/web2py/gluon/restricted.py", line 173, in
> restricted
>     exec ccode in environment
>   File "/home/kachna/work/web2py/applications/CHTrainCup/controllers/
> admin.py", line 42, in <module>
>   File "/home/kachna/work/web2py/gluon/globals.py", line 96, in
> <lambda>
>     self._caller = lambda f: f()
>   File "/home/kachna/work/web2py/gluon/tools.py", line 1863, in f
>     return action(*a, **b)
>   File "/home/kachna/work/web2py/applications/CHTrainCup/controllers/
> admin.py", line 38, in edit
>     form_edit = crud.update(db[request.vars['tbl']],
> request.vars['id'])
>   File "/home/kachna/work/web2py/gluon/tools.py", line 2353, in update
>     upload=self.settings.download_url,
>   File "/home/kachna/work/web2py/gluon/sqlhtml.py", line 640, in
> __init__
>     self.record_id = str(record['id'])
>
> Can anybody help me? thx

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected].
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.

Reply via email to