[Checkins] SVN: z3c.unconfigure/trunk/ Added support for zope.configuration 3.8.0, which changed the internal

Marius Gedminas cvs-admin at zope.org
Thu Oct 25 09:32:03 UTC 2012


Log message for revision 128143:
  Added support for zope.configuration 3.8.0, which changed the internal
  data structures from tuples to dicts.
  
  Dropped support for zope.configuration 3.7.x and older.
  
  

Changed:
  U   z3c.unconfigure/trunk/CHANGES.txt
  U   z3c.unconfigure/trunk/setup.py
  U   z3c.unconfigure/trunk/src/z3c/unconfigure/README.txt
  U   z3c.unconfigure/trunk/src/z3c/unconfigure/config.py

-=-
Modified: z3c.unconfigure/trunk/CHANGES.txt
===================================================================
--- z3c.unconfigure/trunk/CHANGES.txt	2012-10-24 14:37:41 UTC (rev 128142)
+++ z3c.unconfigure/trunk/CHANGES.txt	2012-10-25 09:32:02 UTC (rev 128143)
@@ -11,8 +11,11 @@
 1.1 (unreleased)
 ----------------
 
-* ...
+* Added support for zope.configuration 3.8.0, which changed the internal
+  data structures from tuples to dicts.
 
+* Dropped support for zope.configuration 3.7.x and older.
+
 1.0.1 (2008-08-07)
 ------------------
 

Modified: z3c.unconfigure/trunk/setup.py
===================================================================
--- z3c.unconfigure/trunk/setup.py	2012-10-24 14:37:41 UTC (rev 128142)
+++ z3c.unconfigure/trunk/setup.py	2012-10-25 09:32:02 UTC (rev 128143)
@@ -34,7 +34,7 @@
     include_package_data=True,
     zip_safe=False,
     install_requires=['setuptools',
-                      'zope.configuration',
+                      'zope.configuration >= 3.8.0',
                       'zope.component', # technically [zcml]
                       'zope.security',
                       'zope.event',

Modified: z3c.unconfigure/trunk/src/z3c/unconfigure/README.txt
===================================================================
--- z3c.unconfigure/trunk/src/z3c/unconfigure/README.txt	2012-10-24 14:37:41 UTC (rev 128142)
+++ z3c.unconfigure/trunk/src/z3c/unconfigure/README.txt	2012-10-25 09:32:02 UTC (rev 128143)
@@ -118,7 +118,7 @@
   ...   </unconfigure>
   ...   <print msg="The final goodbye" />
   ... </configure>
-  ... """)
+  ... """)  # XXX this is currently broken, so the test fails
   The new hello
   The final goodbye
 

Modified: z3c.unconfigure/trunk/src/z3c/unconfigure/config.py
===================================================================
--- z3c.unconfigure/trunk/src/z3c/unconfigure/config.py	2012-10-24 14:37:41 UTC (rev 128142)
+++ z3c.unconfigure/trunk/src/z3c/unconfigure/config.py	2012-10-25 09:32:02 UTC (rev 128143)
@@ -28,7 +28,7 @@
 
 
 def is_subscriber(discriminator, callable=None, args=(), kw={},
-                  includepath=(), info='', order=0):
+                  includepath=(), info='', order=0, **extra):
     """Determines whether the action has been emitted from the
     <subscriber /> directive.
     """
@@ -37,12 +37,12 @@
             args[0] == 'registerHandler')
 
 def real_subscriber_factory(discriminator, callable=None, args=(), kw={},
-                            includepath=(), info='', order=0):
+                            includepath=(), info='', order=0, **extra):
     """Returns the real subscriber factory[#] and type of even that
     the subscriber is registered for ('for' parameter).
 
     This function assumes that the action in question is a subscriber
-    action.  In other words, is_subscriber(*args) is True.
+    action.  In other words, is_subscriber(**args) is True.
 
     [#] Under certain circumstances, <subscriber /> wraps factories in
     some security- or location-related adapter factory.
@@ -64,29 +64,30 @@
         # context.actions which would otherwise be "inherited" by our
         # superclass's __getattr__.  By shadowing the original list,
         # all actions within 'unconfigure' will be added to this list
-        # here, not the global actions list. 
+        # here, not the global actions list.
         self.actions = []
 
     def after(self):
         # Get a discriminator -> action representation of all the
         # actions that have been churned out so far.
-        unique = dict((action[0], action) for action in self.context.actions
-                      if action[0] is not None)
+        unique = dict((action['discriminator'], action)
+                      for action in self.context.actions
+                      if action['discriminator'] is not None)
 
         # Special-case subscriber actions: Find all subscriber actions
         # and store them as (factory, for) -> action.  They're a
         # special case because their discriminators are None, so we
         # can't pull the same trick as with other directives.
-        subscribers = dict((real_subscriber_factory(*action), action)
+        subscribers = dict((real_subscriber_factory(**action), action)
                            for action in self.context.actions
-                           if is_subscriber(*action))
+                           if is_subscriber(**action))
 
         # Now let's go through the actions within 'unconfigure' and
         # use their discriminator to remove the real actions
         for unaction in self.actions:
             # Special-case subscriber actions.
-            if is_subscriber(*unaction):
-                factory, for_ = real_subscriber_factory(*unaction)
+            if is_subscriber(**unaction):
+                factory, for_ = real_subscriber_factory(**unaction)
                 action = subscribers.get((factory, for_))
                 if action is None:
                     continue
@@ -94,7 +95,7 @@
                 del subscribers[(factory, for_)]
 
             # Generic from here
-            discriminator = unaction[0]
+            discriminator = unaction['discriminator']
             if discriminator is None:
                 continue
             action = unique.get(discriminator)
@@ -115,4 +116,5 @@
         # actions with a null value.  Actions whose callable is None
         # won't be executed.
         i = self.context.actions.index(action)
-        self.context.actions[i] = (None, None)
+        self.context.actions[i] = dict(discriminator=None, callable=None,
+                                       args=(), kw={}, order=0)



More information about the checkins mailing list