Book Edit Suggestion

3 views
Skip to first unread message

villas

unread,
Nov 4, 2010, 8:42:20 AM11/4/10
to web2py-users
http://www.web2py.com/book/default/chapter/07#CRUD

I noticed this example in the book which does not seem correct:

def manage():
table=db[request.args(0)]
form = crud.update(table,request.args(1))
table.id.represent = lambda id: \
A('edit:',id,_href=URL(args=(request.args(0),id)))
search, rows = crud.select(table) # <<<------
return dict(form=form,search=search,rows=rows)

May I suggest replacing the marked line:
search, rows = crud.select(table)

with these two lines:
search = crud.search(table)
rows = crud.select(table)

-D

Bruno Rocha

unread,
Nov 4, 2010, 11:29:16 PM11/4/10
to web...@googlegroups.com
It is ok to do

search, rows = crud.search(table), crud.select(table)

Edited!

2010/11/4 villas <vill...@gmail.com>



--

http://rochacbruno.com.br

mdipierro

unread,
Nov 4, 2010, 11:58:54 PM11/4/10
to web2py-users
Just:

search, rows = crud.search(table)

search returns a tuple.

On Nov 4, 10:29 pm, Bruno Rocha <rochacbr...@gmail.com> wrote:
> It is ok to do
>
> search, rows = crud.search(table), crud.select(table)
>
> Edited!
>
> 2010/11/4 villas <villa...@gmail.com>

rochacbruno

unread,
Nov 5, 2010, 12:42:57 AM11/5/10
to web...@googlegroups.com
Sorry I didnt test this way.

I also didnt know that search returns a select.

Enviado via iPhone

villas

unread,
Nov 5, 2010, 5:48:49 AM11/5/10
to web2py-users
Good to know. I suppose you just need to change the 'select' to
'search'.
However, it would be nice to mention that tuple! :)

On Nov 5, 4:42 am, rochacbruno <rochacbr...@gmail.com> wrote:
> Sorry I didnt test this way.
>
> I also didnt know that search returns a select.
>
> Enviado via iPhone
>
Reply all
Reply to author
Forward
0 new messages