BJörn Lindqvist wrote:
>
> A few reasons. I want multiple methods that share a save() method:
>
> ...
> def add_stuff_one_way(self):
>     return dict(...)
>
> def add_stuff_another_way(self):
>     return dict(...)
>
> def save(self, ....):
>     save called from either add_stuff_one_way() or add_stuff_another_way()
>
> In a setup like this, the @error_handler decorator doesn't work
> because it only takes one argument.
>
> The other reason is that I don't want to use TurboGears widgets, and
> @validate and @error_handler seem to be tightly coupled to the widget
> system.
>
> --
> mvh Björn

Actually, validate is tightly coupled with validators, not widgets
specifically.  You can use validate without error_handler and just add
a tg_errors keyword parameter to your save method.  It can then do
something approprate, like call the correct original add method (hidden
field in the form perhaps?).  I have often found it useful to use
validate without error_handler for just this reason.  (Though I am
probably not using error_handler to it's fullest.)

Also, validate does not need to take a form as a parameter.  You can
feed it a validators keyword argument with just a list of validators.
No widgets necessary.  Though you probably already knew this from
reading the source.

Or, as previously mentioned, you can do it all by hand.

I guess I'm just saying that you can use some parts and not the others
and you don't have to throw out all the validation functionality that
TG has.

Anyway, hope this helps,
Krys Wilken


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to