[z3-five] Wrapping Z2 interfaces (maybe, "bride of Frankenzope"?)
Tres Seaver
tseaver at zope.com
Mon Aug 2 16:00:12 MEST 2004
For existing Zope2 applications which already declare and use Zope2
interfaces, it seems natural to re-use those specifications. I have a
utility module (with a handful of tests) which exports
'fromZ2Interface', a function which introspects a Zope2 interface object
and synthesizes an "equivalent" Zope 3 interface.
I am currently using it in a scratch product, CMFonFive, to populate the
'interfaces' module, e.g.:
from utilities import fromZ2Interface
from Products.CMFCore.interfaces.CachingPolicyManager \
import CachingPolicyManager as _IZ2_CachingPolicyManager
ICachingPolicyManager = fromZ2Interface(_IZ2_CachingPolicyManager)
del _IZ2_CachingPolicyManager
The amount of noisy boilerplate in that module is painful: I did take
the opportunity to rename CMF interfaces, but that is the only real
"value" the module adds. I am pondering a ZCML directive which would
remove the need for the boilerplate; something like:
<five:bolt-on
source="Products.CMFCore.interfaces.CachingPolicyManager.CachingPolicyManager"
target=".interfaces.ICachingPolicyManager"
/>
Would the utility be useful in Five? The directive?
Tres.
--
===============================================================
Tres Seaver tseaver at zope.com
Zope Corporation "Zope Dealers" http://www.zope.com
More information about the z3-five
mailing list