[Checkins] SVN: z3c.baseregistry/branches/zope-configuration-action-dict/ - zope.configuration changed action tuples to action dicts. This version works

Roger Ineichen cvs-admin at zope.org
Tue May 29 23:18:25 UTC 2012


Log message for revision 126519:
  - zope.configuration changed action tuples to action dicts. This version works
    with the new action dict given from zope.configuration since version 3.8.0.
    This version is not compatible with zope.configuration version less then
    3.8.0

Changed:
  U   z3c.baseregistry/branches/zope-configuration-action-dict/CHANGES.txt
  U   z3c.baseregistry/branches/zope-configuration-action-dict/setup.py
  U   z3c.baseregistry/branches/zope-configuration-action-dict/src/z3c/baseregistry/README.txt
  U   z3c.baseregistry/branches/zope-configuration-action-dict/src/z3c/baseregistry/zcml.py

-=-
Modified: z3c.baseregistry/branches/zope-configuration-action-dict/CHANGES.txt
===================================================================
--- z3c.baseregistry/branches/zope-configuration-action-dict/CHANGES.txt	2012-05-29 20:52:34 UTC (rev 126518)
+++ z3c.baseregistry/branches/zope-configuration-action-dict/CHANGES.txt	2012-05-29 23:18:21 UTC (rev 126519)
@@ -2,10 +2,13 @@
 CHANGES
 =======
 
-1.3.1 (unreleased)
+2.0.0 (unreleased)
 ------------------
 
-- Nothing changed yet.
+- zope.configuration changed action tuples to action dicts. This version works
+  with the new action dict given from zope.configuration since version 3.8.0.
+  This version is not compatible with zope.configuration version less then
+  3.8.0
 
 
 1.3.0 (2010-10-28)

Modified: z3c.baseregistry/branches/zope-configuration-action-dict/setup.py
===================================================================
--- z3c.baseregistry/branches/zope-configuration-action-dict/setup.py	2012-05-29 20:52:34 UTC (rev 126518)
+++ z3c.baseregistry/branches/zope-configuration-action-dict/setup.py	2012-05-29 23:18:21 UTC (rev 126519)
@@ -23,7 +23,7 @@
 
 setup (
     name = "z3c.baseregistry",
-    version='1.3.1dev',
+    version='2.0.0',
     author = "Stephan Richter, Roger Ineichen and the Zope Community",
     author_email = "zope-dev at zope.org",
     description = "Manage IComponents instances using Python code and ZCML.",

Modified: z3c.baseregistry/branches/zope-configuration-action-dict/src/z3c/baseregistry/README.txt
===================================================================
--- z3c.baseregistry/branches/zope-configuration-action-dict/src/z3c/baseregistry/README.txt	2012-05-29 20:52:34 UTC (rev 126518)
+++ z3c.baseregistry/branches/zope-configuration-action-dict/src/z3c/baseregistry/README.txt	2012-05-29 23:18:21 UTC (rev 126519)
@@ -112,9 +112,9 @@
   >>> cPickle.loads(jar)
   Traceback (most recent call last):
   ...
-  ComponentLookupError: (ComponentLookupError(<InterfaceClass zope.component.interfaces.IComponents>, 'myRegistry'),
-                        <function BC at 0x...>,
-                        (<BaseGlobalComponents base>, 'myRegistry'))
+  ComponentLookupError: (ComponentLookupError(<InterfaceClass zope.interface.interfaces.IComponents>, 'myRegistry'),
+                         <function BC at ...>,
+                         (<BaseGlobalComponents base>, 'myRegistry'))
 
 This is because we have not registered the registry in its parent as an
 ``IComponents`` utility, yet:

Modified: z3c.baseregistry/branches/zope-configuration-action-dict/src/z3c/baseregistry/zcml.py
===================================================================
--- z3c.baseregistry/branches/zope-configuration-action-dict/src/z3c/baseregistry/zcml.py	2012-05-29 20:52:34 UTC (rev 126518)
+++ z3c.baseregistry/branches/zope-configuration-action-dict/src/z3c/baseregistry/zcml.py	2012-05-29 23:18:21 UTC (rev 126519)
@@ -43,11 +43,21 @@
         self.original = original
         self.registry = registry
 
-    def __decorate(self, item):
-        discriminator = None
-        if item[0] is not None:
-            discriminator = (self.registry, item[0])
-        return (discriminator,) + item[1:]
+    def __decorate(self, action):
+        # handle action dict
+        # (was a tuple before 2.0, see zope.configuration 3.8 for changes)
+        # discriminator is a tuple like:
+        # ('utility',
+        #  <InterfaceClass zope.component.interfaces.IFactory>,
+        #  'my.package.interfaces.IMyInterface')
+        # in the sample above this means we need to prepend our registry
+        # to the existing discriminator.
+        discriminator = action.get('discriminator', None)
+        if discriminator is not None:
+            # replace the first part from the existing descriminator tuple
+            # with our registry
+            action['discriminator'] = (self.registry, discriminator)
+        return action
 
     def __setitem__(self, i, item):
         self.original.__setitem__(i, self.__decorate(item))



More information about the checkins mailing list