[Zope-dev] coding style: using zapi recommended?
yuppie
y.2008 at wcm-solutions.de
Mon Apr 14 06:57:37 EDT 2008
Hi!
Products.Five.browser.adding is basically a copy of
zope.app.container.browser.adding. Over time they became more out of
sync than necessary. I'd like to fix that, but have one question:
In the Five version
from zope.app import zapi
factory = zapi.getUtility(IFactory, type_name)
was replaced by
import zope.component
factory = zope.component.getUtility(IFactory, type_name)
(http://svn.zope.org/Products.Five/trunk/browser/adding.py?rev=67820&r1=67728&r2=67820)
Was this a code modernization that should be ported to
zope.app.container? Or should I revert the change in Products.Five?
Keeping two different versions makes it unnecessarily hard to read the
diffs.
Personally, I prefer yet an other version:
from zope.component import getUtility
factory = getUtility(IFactory, type_name)
But I don't want to change both files if there is no recommended version.
Maybe we don't need a strict policy for this, but some guidance would be
nice to have.
Any opinions? Any guidelines I missed?
Cheers,
Yuppie
More information about the Zope-Dev
mailing list