On Mon, Aug 31, 2009 at 6:48 AM, andres<[email protected]> wrote:
>
> I'm trying to rate limit based on application specific information so
> I have to do it within the pylons app. I'll also configure Apache to
> prevent more basic attacks.
>
> At some point I want to open source the module I'm working on so I'll
> probably implement it as middleware. I've had problems handling
> exceptions in middleware though. What's the best way to get the last
> exception raised?

I don't know specifically about this, but I've had luck moving the
middleware lower in the stack.  It behaves differently depending on
which side of the error handlers it's located.  The "ADD MIDDLEWARE
HERE" location is appropriate for most middleware but not all.

As for whether Pylons captures and transforms exceptions, the answer
is somewhere in pylons/wsgiapp.py or pylons/controllers/*.py .  The
"Pylons Execution Analysis" might help, although it's still at 0.9.6
so there may be some minor differences.

http://wiki.pylonshq.com/display/pylonscookbook/Pylons+Execution+Analysis+0.9.6

> What's the difference between __call__ and __before__?

.__before__ and .__after__ are convenience methods.  Some code fits
naturally into these methods , and doing so avoids the inconvenience
of re-implementing the call block.

But some code needs to span both the beginning and end, such as a
'try' around the superclass call.  These have to be implemented in
.__call__.

-- 
Mike Orr <[email protected]>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to