Dabbled with it some more, and it seems that the problem doesn't exist only
when using the super class to generate the form. I've tried a couple of
functions that generate the form within the controller. The first variant
is this (passing the 'next' directive to validate()):
def create_form():
form = SQLFORM.factory(db.t_mytable)
if form.validate(next = URL('my_controller', 'next_url')):
try:
record_id = MyTable.insert_record(form.vars)
session['new_record_id'] = record_id
except Exception as e:
print e
return form
This totally bypasses the code within the validate() conditional, and
redirects successfully to the url passed to validate().
In the second variant, I'm trying to manually redirect after the code
within validate() is completed:
def create_form():
form = SQLFORM.factory(db.t_mytable)
if form.validate():
try:
record_id = MyTable.insert_record(form.vars)
session['new_record_id'] = record_id
redirect(URL('my_controller', 'next_url')
except Exception as e:
print e
return form
This performs the code within the scope of the validate() conditional,
throws a '303 SEE OTHER' exception, and does not redirect to the function
specified in URL().
Any thoughts as to what could be happening, or ideas on how to debug it?
--
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.