[Zope-Checkins] SVN: Products.Five/branches/1.4/ Setup logic-less
registerPackage zcml directive.
Rocky Burt
rocky at serverzen.com
Sun Mar 12 14:40:39 EST 2006
Log message for revision 65925:
Setup logic-less registerPackage zcml directive.
Changed:
_U Products.Five/branches/1.4/
U Products.Five/branches/1.4/fiveconfigure.py
U Products.Five/branches/1.4/fivedirectives.py
U Products.Five/branches/1.4/meta.zcml
-=-
Property changes on: Products.Five/branches/1.4
___________________________________________________________________
Name: svk:merge
+ 98c0701e-2f07-0410-a1a0-c1bc72243522:/local/Products.Five/branches/1.4:8740
Modified: Products.Five/branches/1.4/fiveconfigure.py
===================================================================
--- Products.Five/branches/1.4/fiveconfigure.py 2006-03-12 18:37:59 UTC (rev 65924)
+++ Products.Five/branches/1.4/fiveconfigure.py 2006-03-12 19:40:39 UTC (rev 65925)
@@ -260,6 +260,22 @@
# clean up code
+def _registerPackage(module_, initFunc=None):
+ """Registers the given python package as a Zope 2 style product
+ """
+
+
+def registerPackage(_context, package, initialize=None):
+ """ZCML directive function for registering a python package product
+ """
+
+ _context.action(
+ discriminator = ('registerPackage', package),
+ callable = _registerPackage,
+ args = (package,initialize)
+ )
+
+
def killMonkey(class_, name, fallback, attr=None):
"""Die monkey, die!"""
method = getattr(class_, name, None)
Modified: Products.Five/branches/1.4/fivedirectives.py
===================================================================
--- Products.Five/branches/1.4/fivedirectives.py 2006-03-12 18:37:59 UTC (rev 65924)
+++ Products.Five/branches/1.4/fivedirectives.py 2006-03-12 19:40:39 UTC (rev 65925)
@@ -178,3 +178,20 @@
u'installed Product. If the file does not exist, for a '
u'particular product, no error is raised.',
required=False)
+
+class IRegisterPackageDirective(Interface):
+ """Registers the given python package which at a minimum fools zope2 into
+ thinking of it as a zope2 product.
+ """
+
+ package = GlobalObject(
+ title=u'Target package',
+ required=True
+ )
+
+ initialize = GlobalObject(
+ title=u'Initialization function to invoke',
+ description=u'The dotted name of a function that will get invoked '
+ u'with a ProductContext instance',
+ required=False
+ )
Modified: Products.Five/branches/1.4/meta.zcml
===================================================================
--- Products.Five/branches/1.4/meta.zcml 2006-03-12 18:37:59 UTC (rev 65924)
+++ Products.Five/branches/1.4/meta.zcml 2006-03-12 19:40:39 UTC (rev 65925)
@@ -157,6 +157,12 @@
handler=".fiveconfigure.registerClass"
/>
+ <meta:directive
+ name="registerPackage"
+ schema=".fivedirectives.IRegisterPackageDirective"
+ handler=".fiveconfigure.registerPackage"
+ />
+
</meta:directives>
<meta:directive
More information about the Zope-Checkins
mailing list