[Twisted-Python] Accessing app-wide data in Woven
Donovan Preston
dp at twistedmatrix.com
Fri Jul 18 12:28:46 MDT 2003
On Friday, July 18, 2003, at 11:12AM, Itamar Shtull-Trauring wrote:
> On Fri, 18 Jul 2003 13:58:53 -0400
> Christopher Armstrong <radix at twistedmatrix.com> wrote:
>
>>> The top-level RPY does:
>>>
>>> request.setComponent(ISiteConfiguration, myConfig)
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.
>> well, the request isn't available in the rpy, only in the methods of
>> the resource it returns
Maybe it should be. I suppose that makes it possible for people to
confuse an rpy with a cgi-like thing and write epy like scripts though.
Maybe it's just an education issue.
> You'd set it in the rpy's resource's getChild, probably.
Unfortunately you have to set it both in getChild and render on the
root if you want to ensure it is always available. Slightly
inconvenient.
dp
More information about the Twisted-Python
mailing list