I found this thread that discusses when a designated error handler has
its own error handler.

The error handler's validators are not run.

http://groups.google.com/group/turbogears/browse_thread/thread/d8a8af2b60a65714/40bc1b97141b03b8

Mark Ramm made this remark:

Also, there's no reason you can't call the validator directly inside
your controller object, bypassing the whole TG validation decorator
thing all together, and for your use case, that seems reasonable.  In
TG2 we just merge the unvalidated params back into the params
dictionary, so everything that can be validated is, and the
error_handler is called with a mixed set of validated and unvalidated
data (so that it can have the same signature as the method it's
handling errors for).

How do I rerun the validator manually?

For the code below, when processform kicks back to drawform, how do I
run the MyValidator on the sh parameter?

@validate(validators={'sh':MyValidator()})
def drawform(self, sh, tg_errors=None):
    "draw the form"
    return dict(myform=myform)

@validate(form=myform)
@error_handler(drawform)
def processform(self, **kwargs):
    "save the data"


Is this the correct way:

    if tg_errors:
        v = MyValidator()
        sh = v.to_python(sh)

Or is there something fancier?
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to