Hi, I was doing some tutorial from the web2py book, i ran into this
following code
def first():
form = SQLFORM.factory(Field('visitor_name', requires=IS_NOT_EMPTY()))
if form.process().accepted:
name = form.vars.visitor_name
redirect(URL('second',vars=dict(name=name))) # i did not get the logic
behind vars=dict(name=name)))
return dict(form=form) # I know it's a dictionary, I also know dictionary
should be keys and values, how can a form be both keys and values here.
instead of dict(form=form) shouldn't it be dict(something=form), since
something is a key and form is a variable.
def second():
name = request.vars.visitor_name or redirect(URL('first'))
return dict(name=name)
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.