Hi,
I want to validate a form (with all its side effects,
namely error messages on re-displaying) *after* receiving
all arguments unchanged to my controller method. The following
pattern works, ...
----------------------------------8<--------------------
class MyController(Controller):
@validate(form=edit_form)
def validate_edit_form(self, tg_errors=None, **input_data):
return tg_errors
@expose(template="myproject.templates.edit")
def edit(self, **input_data):
form_data = dict()
if len(input_data) == 0:
pass # load initial data into form_data
else:
if len(self.validate_edit_form(**input_data)) == 0:
pass # save data and redirect
return dict(form=edit_form, data=form_data)
---------------------------------->8--------------------
..., but I wonder if the is a simpler way than to write a
do-nothing-method and decorating that. I couldn't find a method
on the form object that would to the same for me. So, if anybody
could point me to a simpler solution... (BTW, this is a
simplified case, there are reasons, I don't want to use multiple
methods.)
Cheers,
--Jan Niklas
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---