[Checkins] SVN: z3c.baseregistry/trunk/ merging branches/zope-configuration-action-dict

Adam Groszer cvs-admin at zope.org
Fri Aug 24 07:07:12 UTC 2012


Log message for revision 127562:
  merging branches/zope-configuration-action-dict
  dict style action new in zope.configuration since 3.8.0

Changed:
  U   z3c.baseregistry/trunk/CHANGES.txt
  U   z3c.baseregistry/trunk/setup.py
  U   z3c.baseregistry/trunk/src/z3c/baseregistry/README.txt
  U   z3c.baseregistry/trunk/src/z3c/baseregistry/zcml.py

-=-
Modified: z3c.baseregistry/trunk/CHANGES.txt
===================================================================
--- z3c.baseregistry/trunk/CHANGES.txt	2012-08-23 18:46:11 UTC (rev 127561)
+++ z3c.baseregistry/trunk/CHANGES.txt	2012-08-24 07:07:08 UTC (rev 127562)
@@ -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/trunk/setup.py
===================================================================
--- z3c.baseregistry/trunk/setup.py	2012-08-23 18:46:11 UTC (rev 127561)
+++ z3c.baseregistry/trunk/setup.py	2012-08-24 07:07:08 UTC (rev 127562)
@@ -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.",
@@ -68,7 +68,7 @@
     install_requires = [
         'setuptools',
         'zope.component >= 3.9.4',
-        'zope.configuration',
+        'zope.configuration >= 3.8.0',
         'zope.i18nmessageid',
         'zope.interface',
         'zope.schema',

Modified: z3c.baseregistry/trunk/src/z3c/baseregistry/README.txt
===================================================================
--- z3c.baseregistry/trunk/src/z3c/baseregistry/README.txt	2012-08-23 18:46:11 UTC (rev 127561)
+++ z3c.baseregistry/trunk/src/z3c/baseregistry/README.txt	2012-08-24 07:07:08 UTC (rev 127562)
@@ -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/trunk/src/z3c/baseregistry/zcml.py
===================================================================
--- z3c.baseregistry/trunk/src/z3c/baseregistry/zcml.py	2012-08-23 18:46:11 UTC (rev 127561)
+++ z3c.baseregistry/trunk/src/z3c/baseregistry/zcml.py	2012-08-24 07:07:08 UTC (rev 127562)
@@ -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