Christopher Arndt wrote:

> Use the 'state_factory' argument to the @validator decorator:
> 
> @validate(form=myform, state_factory=state_provider)
> def exposed_method(self, ...):
>    ...
> 
> The argument value should be a callable, that returns a 'Bunch'-like class,
> i.e. just stick whatever you need as an attribute onto the object.
> 
> Here's one I use:
> 
> from turbogears.util import Bunch
> 
> def request_provider(state=None):
>     """Provide request information to validation schemas."""
> 
>     if state is None:
>         return Bunch(request=cherrypy.request)
>     state.request = cherrypy.request
>     return state
> 
> HTH, Chris
> 

Thanks Chris,

That was just what I needed.

Rupert

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