Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Message from discussion The Future of TurboGears
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Mark Ramm  
View profile  
 More options Jun 28 2007, 4:25 pm
From: "Mark Ramm" <mark.mchristen...@gmail.com>
Date: Thu, 28 Jun 2007 16:25:39 -0400
Local: Thurs, Jun 28 2007 4:25 pm
Subject: Re: [TurboGears] Re: The Future of TurboGears

> 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).

--Mark Ramm


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.