[Checkins] SVN: zope.locking/trunk/src/zope/locking/ - Consolidate duplicate evolution code.

Alex Smith alex at zope.com
Mon Jan 31 11:19:39 EST 2011


Log message for revision 120027:
  - Consolidate duplicate evolution code.
  - Split generations config into its own zcml file.
  

Changed:
  U   zope.locking/trunk/src/zope/locking/CHANGES.txt
  U   zope.locking/trunk/src/zope/locking/configure.zcml
  U   zope.locking/trunk/src/zope/locking/generations.py
  A   zope.locking/trunk/src/zope/locking/generations.zcml

-=-
Modified: zope.locking/trunk/src/zope/locking/CHANGES.txt
===================================================================
--- zope.locking/trunk/src/zope/locking/CHANGES.txt	2011-01-31 16:11:27 UTC (rev 120026)
+++ zope.locking/trunk/src/zope/locking/CHANGES.txt	2011-01-31 16:19:38 UTC (rev 120027)
@@ -8,6 +8,15 @@
 
 
 ------------------
+1.2.2 (2011-01-31)
+------------------
+
+- Consolidate duplicate evolution code.
+
+- Split generations config into its own zcml file.
+
+
+------------------
 1.2.1 (2010-01-20)
 ------------------
 

Modified: zope.locking/trunk/src/zope/locking/configure.zcml
===================================================================
--- zope.locking/trunk/src/zope/locking/configure.zcml	2011-01-31 16:11:27 UTC (rev 120026)
+++ zope.locking/trunk/src/zope/locking/configure.zcml	2011-01-31 16:19:38 UTC (rev 120027)
@@ -77,11 +77,7 @@
 
   <include package=".browser" />
 
-  <utility
-     name="zope.locking"
-     provides="zope.app.generations.interfaces.ISchemaManager"
-     component=".generations.schemaManager"
-    />
+  <include file="generations.zcml" />
 
   <configure
     xmlns:zcml="http://namespaces.zope.org/zcml"

Modified: zope.locking/trunk/src/zope/locking/generations.py
===================================================================
--- zope.locking/trunk/src/zope/locking/generations.py	2011-01-31 16:11:27 UTC (rev 120026)
+++ zope.locking/trunk/src/zope/locking/generations.py	2011-01-31 16:19:38 UTC (rev 120027)
@@ -1,10 +1,10 @@
 import BTrees.OOBTree
+import zope.app.generations.interfaces
 import zope.interface
-import zope.app.generations.interfaces
-
 import zope.locking.interfaces
 import zope.locking.utils
 
+
 class SchemaManager(object):
 
     zope.interface.implements(
@@ -17,19 +17,13 @@
         # Clean up cruft in any existing token utilities.
         # This is done here because zope.locking didn't have a
         # schema manager prior to 1.2.
-        app = context.connection.root().get('Application')
-        if app is not None:
-            for util in find_token_utilities(app):
-                fix_token_utility(util)
+        clean_locks(context)
 
     def evolve(self, context, generation):
         if generation == 2:
             # Going from generation 1 -> 2, we need to run the token
             # utility fixer again because of a deficiency it had in 1.2.
-            app = context.connection.root().get('Application')
-            if app is not None:
-                for util in find_token_utilities(app):
-                    fix_token_utility(util)
+            clean_locks(context)
 
 
 schemaManager = SchemaManager()
@@ -43,6 +37,14 @@
     return _get_site_managers(app_root.getSiteManager())
 
 
+def clean_locks(context):
+    """Clean out old locks from token utilities."""
+    app = context.connection.root().get('Application')
+    if app is not None:
+        for util in find_token_utilities(app):
+            fix_token_utility(util)
+
+
 def find_token_utilities(app_root):
     for sm in get_site_managers(app_root):
         for registration in sm.registeredUtilities():

Added: zope.locking/trunk/src/zope/locking/generations.zcml
===================================================================
--- zope.locking/trunk/src/zope/locking/generations.zcml	                        (rev 0)
+++ zope.locking/trunk/src/zope/locking/generations.zcml	2011-01-31 16:19:38 UTC (rev 120027)
@@ -0,0 +1,11 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    i18n_domain="zope.locking">
+
+  <utility
+     name="zope.locking"
+     provides="zope.app.generations.interfaces.ISchemaManager"
+     component=".generations.schemaManager"
+    />
+
+</configure>



More information about the checkins mailing list