[Zope-CMF] Re: [CMF 2.1] FSPageTemplate & Unicode
Martin Aspeli
optilude at gmx.net
Sat Jan 6 10:03:20 EST 2007
Jens Vagelpohl wrote:
> It's just a bit unintuitive that sometimes you must wrap them, sometimes
> you don't need to. For a third party coder this could turn into a major
> headache and bug bear.
I would say it's very bad if we need to train people on when aq-wrapping
tools (using __of__() say) is required and when it's not. In fact, I'd
say its catastrophic and will break incredible amounts of existing code.
If getToolByName() keps aq wrapping, though, then legacy code shouldn't
be affected, so it's only new code using getUtility().
In this case, we probably need to fix the tools themselves so that they
don't depend on being aq-wrapped. Actually, Hanno's suggestion is kind
of neat. Let the persistent portal object be a (the only) utility
providing ISiteRoot in the local utility registry, and when tools need
to get the portal, root, do:
portal = getUtility(ISiteRoot)
I guess it's rare that we'd want to acquire anything from above the
portal in a tool (user folders being the only thing I can think of).
We may yet find ourselves in pain in things like Remember or PlonePAS or
bits of CMFPlone that override and monkey patch tools, but at least
those can be contained.
Martin
More information about the Zope-CMF
mailing list