[Twisted-Python] Accessing app-wide data in Woven

Glyph Lefkowitz glyph at twistedmatrix.com
Fri Jul 18 16:58:14 EDT 2003

On Friday, July 18, 2003, at 01:28 PM, Donovan Preston wrote:

> This is precisely why I made the resource Componentized. It's far more 
> convenient and less error-prone to do this than to attempt to make 
> sure that a reference to your Configuration object is passed to every 
> single child in your system.

While I agree that it's better to use a component on the resource than 
to randomly set a junk attribute, I'd also like to caution against 
using this too much.  Unless you're doing something like computing 
relative links, it's a lot safer and less surprising to explicitly pass 
references around in your application.  This might involve more typing, 
but trying to "throw" objects to other parts of your application, using 
the registry, the Componentized request, or the session makes it 
dependent upon an execution context.  That context is often present, 
but it's an undeclared requirement, so it can be a very surprising 
impediment to using a particular kind of resource from some other code 
that does a related but not identical thing.

More information about the Twisted-Python mailing list