[Checkins] SVN: zope.component/branches/wichert-utility-factories/src/zope/component/zcml.py Call registerUtility the right way

Wichert Akkerman wichert at wiggy.net
Wed Jul 23 05:40:46 EDT 2008


Log message for revision 88754:
  Call registerUtility the right way

Changed:
  U   zope.component/branches/wichert-utility-factories/src/zope/component/zcml.py

-=-
Modified: zope.component/branches/wichert-utility-factories/src/zope/component/zcml.py
===================================================================
--- zope.component/branches/wichert-utility-factories/src/zope/component/zcml.py	2008-07-23 09:34:03 UTC (rev 88753)
+++ zope.component/branches/wichert-utility-factories/src/zope/component/zcml.py	2008-07-23 09:40:46 UTC (rev 88754)
@@ -400,10 +400,8 @@
 
 def utility(_context, provides=None, component=None, factory=None,
             permission=None, name=''):
-    if factory:
-        if component:
-            raise TypeError("Can't specify factory and component.")
-        component = factory()
+    if factory and component:
+        raise TypeError("Can't specify factory and component.")
 
     if provides is None:
         provides = list(zope.interface.providedBy(component))
@@ -423,7 +421,7 @@
         discriminator = ('utility', provides, name),
         callable = handler,
         args = ('registerUtility', component, provides, name),
-        kwargs = dict(factory=factory), # XXX WTA: Does this work ??
+        kw = dict(factory=factory),
         )
     _context.action(
         discriminator = None,



More information about the Checkins mailing list