On Thu, 2007-28-06 at 16:25 -0400, Mark Ramm wrote:
> > This is probably a stupid question as I don't know WSGI at all, but will
> > it possible to emulate CP tools? They look really useful in CP3. Perhaps
> > part of the end goal should be to provide all the CP convenience
> > features on top of paster too?
> 
> Well, there are some ways to do things before every request using
> __before__() and __after__() methods on the controller classes which
> allow for cross cutting behavior to be added to whole controller
> hierarchies, and we've added four hooks that can be applied by adding
> decorators to individual exposed controller methods:
> 
> * before_validate,
> * before_call,
> * before_render,
> * after_render
> 
> So you can write
> 
> @expose(...)
> @before_validate(function_to_call_before_validation)
> def my_method(self, arguments):
>     pass
> 
> This will register function_to_call_before_validation() to the be
> called before validation is done.  These functions will be able to
> read (and mutate) the
> 
> If you have a use case which isn't covered by either of these
> extension mechanisms, let me know and I'll see what we can do.
> 
> And honestly, if you need something cross-cutting and the above hooks
> don't work writing middleware isn't that difficult, and we'll do what
> we can to make it even easier.   (I believe there are some plans in
> the works for this already).

That sounds really handy! 

Thanks
Iain



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