web2py show() function. (explanation of a line of code)

51 views
Skip to first unread message

deepak sandhu

unread,
Dec 15, 2013, 2:54:43 PM12/15/13
to web...@googlegroups.com

so this is a function show() which I am trying to understand. in the model I do have a db.image table where I stored some images which is pointed in the function.

the only line I am not understanding here is

#image = db.image(request.args(0,cast=int))

In request.args(0, cast=int) why it has 0 as argument? and what does cast=int does? the complete function is below:

def show():
  image = db.image(request.args(0,cast=int)) or redirect(URL('index'))
  return dict(image=image)

Mirko Scavazzin

unread,
Dec 15, 2013, 3:01:14 PM12/15/13
to web...@googlegroups.com
0=>first arg
cast=int => convert it into int (it is a string actually)
IMHO


2013/12/15 deepak sandhu <coli...@gmail.com>

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages