> Hi Dieter!
> Dieter Maurer wrote:
>> Thus, why do local utilities registered by Five (i.e. these utilities are
>> for Zope2 use) do not provide access to the request in the normal
>> Zope2 way?
> That's what we tried first. But it turned out that Zope 3's site manager
> code caches the utilities across request boundaries. AFAICT it would
> have been necessary to rewrite the registry code completely to make sure
> we return always the right request.
>> If they would, local utilities were much nearer to tools and
>> the transition would be facilitated.
> They would be nearer to tools, but also more distant from zope 3
> utilities. I doubt that would really be a win.
This won't solve this particular problem, but it may be worth looking at
how other frameworks work. Pylons, for example, has the request
available as "global" variable - actually a thread-local. Zope could set
the request as a thread local in the same way that it sets the site
manager (so you can get it via getSite()). Calling getRequest() would in
many ways be cleaner than doing self.context.REQUEST or whatever, and
would work regardless of whether the context was acquisition wrapped.
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book
Zope-CMF maillist - Zope-CMF@lists.zope.org
See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests