Alberto Valverde wrote:
> Wrong. Did you really read the source? ;) You can accomplish exactly
> what you're trying to do by specializing error_handler:
>
> @error_handler(add_stuff_one_way, "another_way in tg_errors")
> @error_handler(add_stuff_one_way, "one_way in tg_errors")
> def save(self, ..):
> ...
>
> Now you only need a chained_validator which adds a "one_way" or
> "another_way" to the error_dict if it finds any errors in it (this is
> left as an exercise to the reader). Might be hacky, but works....
Opps, missed the straightest path to destinaton: This can be
accomplished without any custom chained validators or any dirty tricks
by inspecting "kw" for a hidden fields's value. Something like:
@error_handler(add_stuff_one_way, "kw.get('action') == 'one_way'")
@error_handler(add_stuff_another_way, "kw.get('action') ==
'another_way'")
def save(self, ..):
This will branch to "add_stuff_one_way" if the form submitted "one_way"
in the "action" hidden field, same with "add_stuff_another_way".
Did I mention errorhandling's flexibility? ;)
Alberto
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---