Remi wrote:
I use filters all the time for things like:
 - gzip compression (in prod mode)

This seems reasonable to apply globally. If it is conditional, better to be conditional based on mime type than path.

 - automatic XHTML validating of my pages (in dev mode)

Paste has this as middleware. It uses the WDG HTML validator, but using other validators would be easy enough.

 - automatic encoding/decoding of the data

This can't be done in WSGI middleware (it's all bytes). In RhubarbTart I think it should just be done everywhere all the time, it doesn't even need to be conditional. But no encoding or decoding currently exists there.

 - authentication

This should usually be done globally. If anything, it should usually happen above the application, not inside it. (Authorization is another matter, and should be implemented entirely separately from authentication.)

 - caching

There's like a hundred ways to do caching, and it's typically reasonable to use half a dozen at once. This can happen at all sorts of levels.

I currently don't know of any good WSGI-level caching, but I would really like to see something like that, probably using HTTP semantics. This doesn't replace other possible caching (at the decorator level, for instance).

 - sessions

Doing this globally should be fine, so long as actual session loading is lazy. Locking should not be too aggressive either (e.g., reading authentication information from the session shouldn't lock out any concurrent requests). With these things in place I think global session handling works fine.


--
Ian Bicking  /  [EMAIL PROTECTED]  /  http://blog.ianbicking.org

Reply via email to