On Wednesday 05 April 2006 10:07, Reinhold Strobl wrote:
> I want in a utility class to get access with the current (!) database of
> the zope 3 application.
> In views, this is no problem, since I have the context variable, but this
> is not ture for utilities...
There are several possible solutions.
(a) Local utilities do know about the DB. zapi.getParent(utility)
(b) If you rely on the context, then your utility API should incorporate this
in the methods, i.e. utility.method(context, ...)
(c) Use zope.app.component.hooks.getSite() you can get the current site.
I only find solution (b) desirable.
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
Zope3-users mailing list