[Zope3-checkins] CVS: Zope3/src/zope/app/component - contentdirective.py:1.12 metaconfigure.py:1.24

Garrett Smith garrett at mojave-corp.com
Thu Jan 8 15:48:52 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/component
In directory cvs.zope.org:/tmp/cvs-serv3742/src/zope/app/component

Modified Files:
	contentdirective.py metaconfigure.py 
Log Message:
Added factory 'info' to the factory service. This can be used to lookup
title and description for registered factories. Prior to this change, factory 
title and description defined in ZCML was discarded.

This change is per an exchange back in May:

http://mail.zope.org/pipermail/zope3-dev/2003-May/006915.html

Note that only the factory info portion of the proposed change is 
implemented in this commit. The ability to enumerate registered factories
was implemented earlier.


=== Zope3/src/zope/app/component/contentdirective.py 1.11 => 1.12 ===
--- Zope3/src/zope/app/component/contentdirective.py:1.11	Sun Sep 21 13:31:21 2003
+++ Zope3/src/zope/app/component/contentdirective.py	Thu Jan  8 15:48:21 2004
@@ -18,6 +18,7 @@
 from types import ModuleType
 from zope.interface import implements, classImplements
 from zope.component import getService
+from zope.component.factory import FactoryInfo
 from zope.app.services.servicenames import Interfaces, Factories
 from zope.configuration.exceptions import ConfigurationError
 from zope.app.component.classfactory import ClassFactory
@@ -205,5 +206,6 @@
         permission = CheckerPublic
 
     factory = ClassFactory(_class, title, description, permission)
+    info = FactoryInfo(title, description)
 
-    getService(None, Factories).provideFactory(id, factory)
+    getService(None, Factories).provideFactory(id, factory, info)


=== Zope3/src/zope/app/component/metaconfigure.py 1.23 => 1.24 ===
--- Zope3/src/zope/app/component/metaconfigure.py:1.23	Thu Dec 18 11:28:57 2003
+++ Zope3/src/zope/app/component/metaconfigure.py	Thu Jan  8 15:48:21 2004
@@ -18,6 +18,7 @@
 from zope.configuration.exceptions import ConfigurationError
 from zope.security.proxy import Proxy, ProxyFactory
 from zope.component import getService, getServiceManager
+from zope.component.factory import FactoryInfo
 from zope.app.services.servicenames import Adapters, Interfaces
 from zope.app.services.servicenames import Factories, Presentation
 from zope.app.component.globalinterfaceservice import interfaceService
@@ -134,14 +135,15 @@
                 provides.__module__+'.'+provides.getName(), provides)
         )
 
-def factory(_context, component, id=None, permission=None):
+def factory(_context, component, id=None, title=None, description=None, 
+            permission=None):
     _context.action(
         discriminator = ('factory', id),
         callable = provideFactory,
-        args = (id, component, permission),
+        args = (id, component, title, description, permission),
         )
 
-def provideFactory(name, factory, permission):
+def provideFactory(name, factory, title, description, permission):
     # make sure the permission is defined
     if permission is not None:
         permissionRegistry.ensurePermissionDefined(permission)
@@ -156,7 +158,8 @@
             NamesChecker(('getInterfaces',),
                          __call__=permission)
             )
-    getService(None, Factories).provideFactory(name, factory)
+    info = FactoryInfo(title, description)
+    getService(None, Factories).provideFactory(name, factory, info)
 
 def _checker(_context, permission, allowed_interface, allowed_attributes):
     if (not allowed_attributes) and (not allowed_interface):




More information about the Zope3-Checkins mailing list