I\'m trying to have my form submit to a route which will validate the data then redirect back to the original route.
For example:
A clean way is using the "overload" provided by pyramid for different request types, por example, you can decorate your methods this way:
@action(request_method='GET',
renderer='mypackage:/templates/save.mako',
name='save')
def save(request):
''' Fill the template with default values or leave it blank'''
return {}
@action(request_method='POST',
renderer='mypackage:/templates/save.mako',
name='save')
def save_post(request):
""" form data is submitted here """"
# process form
In the HTML, you must call the action form, like
This way, one method is processed when the method POST is used, and the other when the GET is used. The same name, but two implementations.