It appears to me that Django and Pylons have different ideas on how middleware should work. I like that Pylons follows the standardized PEP 333, but Django seems to have more widespread adoption. Is it possible to write middleware to be used in both?
The project that involves said middleware is porting a security toolkit called ESAPI from Java to Python. Because Java is so standards oriented, it is pretty easy to be framework agnostic. In Python, different frameworks have different ideas on how basic things like HttpRequest objects and middleware work, so this seems more difficult.
Apparently, new users cannot post more than one hyperlink. See below for links to Django and Pylons middleware info.