[Web-SIG] Alternative to threading.local, based on the stack

Manlio Perillo manlio_perillo at libero.it
Mon Jul 7 15:40:15 CEST 2008


Matt Goodall ha scritto:
> [...]
>> True, but even passing a request or env dict around to everyone gets
>> tedious don't you think?
> 
> Yes, it can be tedious but I believe explicit arg passing is necessary
> to make code readable, testable and reusable.
> 
> If it's web-related code then give it the request, it will almost
> certainly need it. Otherwise, don't.
> 
> I would even advocate extracting request-scope objects, e.g. a database
> connection, the current user, etc, as early as possible and passing them
> around explicitly (along with the request, if necessary).
> 

This exactly what I too have realized!

I'm developing a WSGI framework with all these (and other) ideas:
http://hg.mperillo.ath.cx/wsgix

Its still not documented, so I have not yet made an official announcement.

The main design goal is to keep the level of the interface as low level 
as possible.

I don't like additional interfaces (like Request and Response) objects 
around the WSGI dictionary, and I don't like frameworks like Django that 
completely hides the WSGI interface.


 > [...]



Manlio Perillo


More information about the Web-SIG mailing list