[Zope3-checkins] SVN: Zope3/branches/philikon-reduce-zcml/src/zope/app/ Convert a bunch of <vocabulary /> directives to <utility />, with the necessary

Philipp von Weitershausen philikon at philikon.de
Mon Feb 27 10:55:34 EST 2006


Log message for revision 65516:
  Convert a bunch of <vocabulary /> directives to <utility />, with the necessary
  (minor) changes to the vocabulary components themselves.
  

Changed:
  U   Zope3/branches/philikon-reduce-zcml/src/zope/app/content/__init__.py
  U   Zope3/branches/philikon-reduce-zcml/src/zope/app/content/configure.zcml
  U   Zope3/branches/philikon-reduce-zcml/src/zope/app/interface/configure.zcml
  U   Zope3/branches/philikon-reduce-zcml/src/zope/app/interface/vocabulary.py
  U   Zope3/branches/philikon-reduce-zcml/src/zope/app/security/configure.zcml
  U   Zope3/branches/philikon-reduce-zcml/src/zope/app/security/vocabulary.py
  U   Zope3/branches/philikon-reduce-zcml/src/zope/app/securitypolicy/configure.zcml
  U   Zope3/branches/philikon-reduce-zcml/src/zope/app/securitypolicy/vocabulary.py

-=-
Modified: Zope3/branches/philikon-reduce-zcml/src/zope/app/content/__init__.py
===================================================================
--- Zope3/branches/philikon-reduce-zcml/src/zope/app/content/__init__.py	2006-02-27 06:08:01 UTC (rev 65515)
+++ Zope3/branches/philikon-reduce-zcml/src/zope/app/content/__init__.py	2006-02-27 15:55:33 UTC (rev 65516)
@@ -16,12 +16,17 @@
 $Id$
 """
 __docformat__ = 'restructuredtext'
+from zope.interface import classProvides
 from zope.app.interface import queryType
+from zope.app.schema.interfaces import IVocabularyFactory
 from zope.app.content.interfaces import IContentType
+from zope.app.component.vocabulary import UtilityVocabulary
 
 def queryContentType(object):
     """Returns the interface implemented by object which implements
     `IContentType`."""
     return queryType(object, IContentType)
 
-
+class ContentTypesVocabulary(UtilityVocabulary):
+    classProvides(IVocabularyFactory)
+    interface = IContentType

Modified: Zope3/branches/philikon-reduce-zcml/src/zope/app/content/configure.zcml
===================================================================
--- Zope3/branches/philikon-reduce-zcml/src/zope/app/content/configure.zcml	2006-02-27 06:08:01 UTC (rev 65515)
+++ Zope3/branches/philikon-reduce-zcml/src/zope/app/content/configure.zcml	2006-02-27 15:55:33 UTC (rev 65516)
@@ -2,13 +2,12 @@
     xmlns="http://namespaces.zope.org/zope">
 
   <interface
-      interface="zope.app.content.interfaces.IContentType" />
+      interface="zope.app.content.interfaces.IContentType"
+      />
 
-  <vocabulary
+  <utility
+      component=".ContentTypesVocabulary"
       name="Content Types"
-      factory="zope.app.component.vocabulary.UtilityVocabulary"
-      interface="zope.app.content.interfaces.IContentType" />
+      />
 
 </configure>
-
-

Modified: Zope3/branches/philikon-reduce-zcml/src/zope/app/interface/configure.zcml
===================================================================
--- Zope3/branches/philikon-reduce-zcml/src/zope/app/interface/configure.zcml	2006-02-27 06:08:01 UTC (rev 65515)
+++ Zope3/branches/philikon-reduce-zcml/src/zope/app/interface/configure.zcml	2006-02-27 15:55:33 UTC (rev 65516)
@@ -1,7 +1,8 @@
 <configure xmlns="http://namespaces.zope.org/zope">
 
-  <vocabulary
+  <utility
+      component=".vocabulary.ObjectInterfacesVocabulary"
       name="Object Interfaces"
-      factory=".vocabulary.ObjectInterfacesVocabulary" />
+      />
 
 </configure>

Modified: Zope3/branches/philikon-reduce-zcml/src/zope/app/interface/vocabulary.py
===================================================================
--- Zope3/branches/philikon-reduce-zcml/src/zope/app/interface/vocabulary.py	2006-02-27 06:08:01 UTC (rev 65515)
+++ Zope3/branches/philikon-reduce-zcml/src/zope/app/interface/vocabulary.py	2006-02-27 15:55:33 UTC (rev 65516)
@@ -17,10 +17,11 @@
 """
 __docformat__ = 'restructuredtext'
 
-from zope.interface import providedBy
+from zope.interface import classProvides, providedBy
 from zope.security.proxy import removeSecurityProxy
 from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm 
 from zope.app.component.interface import interfaceToName
+from zope.app.schema.interfaces import IVocabularyFactory
 
 
 class ObjectInterfacesVocabulary(SimpleVocabulary):
@@ -50,6 +51,7 @@
      'zope.app.interface.vocabulary.I3',
      'zope.interface.Interface']
     """
+    classProvides(IVocabularyFactory)
 
     def __init__(self, context):
         # Remove the security proxy so the values from the vocabulary

Modified: Zope3/branches/philikon-reduce-zcml/src/zope/app/security/configure.zcml
===================================================================
--- Zope3/branches/philikon-reduce-zcml/src/zope/app/security/configure.zcml	2006-02-27 06:08:01 UTC (rev 65515)
+++ Zope3/branches/philikon-reduce-zcml/src/zope/app/security/configure.zcml	2006-02-27 15:55:33 UTC (rev 65516)
@@ -10,14 +10,15 @@
                    Public resources are always accessible."
       />
 
-  <vocabulary
+  <utility
+      component=".vocabulary.PermissionsVocabulary"
       name="Permissions"
-      factory="zope.app.component.vocabulary.UtilityVocabulary"
-      interface="zope.security.interfaces.IPermission" />
+      />
 
-  <vocabulary
+  <utility
+      component=".vocabulary.PermissionIdsVocabulary"
       name="Permission Ids"
-      factory=".vocabulary.PermissionIdsVocabulary" />
+      />
 
   <include file="globalmodules.zcml" />
   <include file="_protections.zcml" />

Modified: Zope3/branches/philikon-reduce-zcml/src/zope/app/security/vocabulary.py
===================================================================
--- Zope3/branches/philikon-reduce-zcml/src/zope/app/security/vocabulary.py	2006-02-27 06:08:01 UTC (rev 65515)
+++ Zope3/branches/philikon-reduce-zcml/src/zope/app/security/vocabulary.py	2006-02-27 15:55:33 UTC (rev 65516)
@@ -17,26 +17,31 @@
 
 $Id$
 """
+import warnings
 import zope.deprecation
 
 from zope.security.checker import CheckerPublic
 from zope.app import zapi
-from zope.interface import implements
+from zope.interface import implements, classProvides
 from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary
 from zope.schema.interfaces import ISourceQueriables
-from zope.app.security.interfaces import IPermission, IAuthentication
+from zope.security.interfaces import IPermission
+from zope.app.security.interfaces import IAuthentication
 from zope.app.security.interfaces import PrincipalLookupError
+from zope.app.security.interfaces import IPrincipalSource
 from zope.app.component import queryNextUtility
+from zope.app.component.vocabulary import UtilityVocabulary
+from zope.app.schema.interfaces import IVocabularyFactory
 
 # BBB Backward Compatibility
 zope.deprecation.__show__.off()
 from zope.exceptions import NotFoundError
 zope.deprecation.__show__.on()
 
-import warnings
+class PermissionsVocabulary(UtilityVocabulary):
+    classProvides(IVocabularyFactory)
+    interface = IPermission
 
-from interfaces import IPrincipalSource
-
 class PermissionIdsVocabulary(SimpleVocabulary):
     """A vocabular of permission IDs.
 
@@ -97,6 +102,8 @@
 
         >>> tearDown()
     """
+    classProvides(IVocabularyFactory)
+
     def __init__(self, context):
         terms = []
         permissions = zapi.getUtilitiesFor(IPermission, context)

Modified: Zope3/branches/philikon-reduce-zcml/src/zope/app/securitypolicy/configure.zcml
===================================================================
--- Zope3/branches/philikon-reduce-zcml/src/zope/app/securitypolicy/configure.zcml	2006-02-27 06:08:01 UTC (rev 65515)
+++ Zope3/branches/philikon-reduce-zcml/src/zope/app/securitypolicy/configure.zcml	2006-02-27 15:55:33 UTC (rev 65516)
@@ -83,9 +83,10 @@
 
   <!-- Vocabularies -->
 
-  <vocabulary
+  <utility
+      component=".vocabulary.RoleIdsVocabulary"
       name="Role Ids"
-      factory=".vocabulary.RoleIdsVocabulary" />
+      />
 
   <!-- Registering documentation with API doc -->
   <configure
@@ -102,5 +103,4 @@
 
   </configure>
 
-
 </configure>

Modified: Zope3/branches/philikon-reduce-zcml/src/zope/app/securitypolicy/vocabulary.py
===================================================================
--- Zope3/branches/philikon-reduce-zcml/src/zope/app/securitypolicy/vocabulary.py	2006-02-27 06:08:01 UTC (rev 65515)
+++ Zope3/branches/philikon-reduce-zcml/src/zope/app/securitypolicy/vocabulary.py	2006-02-27 15:55:33 UTC (rev 65516)
@@ -17,9 +17,10 @@
 
 $Id$
 """
-from zope.interface import implements
+from zope.interface import implements, classProvides
+from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary
 from zope.app import zapi
-from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary
+from zope.app.schema.interfaces import IVocabularyFactory
 from zope.app.securitypolicy.interfaces import IRole
 from zope.app.securitypolicy.interfaces import IGrantVocabulary
 
@@ -57,6 +58,7 @@
        >>> tearDown()
 
     """
+    classProvides(IVocabularyFactory)
 
     def __init__(self, context):
         terms = []
@@ -68,7 +70,5 @@
 
 class GrantVocabulary(SimpleVocabulary):
     """A vocabular for getting the RadioWidget via the Choice field."""
-    
+    classProvides(IVocabularyFactory)
     implements(IGrantVocabulary)
-
-



More information about the Zope3-Checkins mailing list