[Checkins] SVN: zope.generations/trunk/ Add a transaction note when running generation scripts.

Marius Gedminas marius at pov.lt
Thu Dec 22 19:43:08 UTC 2011


Log message for revision 123858:
  Add a transaction note when running generation scripts.
  
  

Changed:
  U   zope.generations/trunk/CHANGES.txt
  U   zope.generations/trunk/src/zope/generations/README.txt
  U   zope.generations/trunk/src/zope/generations/generations.py

-=-
Modified: zope.generations/trunk/CHANGES.txt
===================================================================
--- zope.generations/trunk/CHANGES.txt	2011-12-22 16:44:22 UTC (rev 123857)
+++ zope.generations/trunk/CHANGES.txt	2011-12-22 19:43:07 UTC (rev 123858)
@@ -8,7 +8,9 @@
 - Removed buildout part which was used during development but does not
   compile on Windows.
 
+- Generation scripts add a transaction note.
 
+
 3.7.0 (2010-09-18)
 ------------------
 
@@ -17,4 +19,4 @@
 - Generations key (stored in database root) has been changed from
   ``zope.app.generations`` to ``zope.generations``.  Migration is done when
   ``evolve`` is run the first time by coping the exisiting generations data
-  over to the new key. So the old and the new key can be used in parallel.
\ No newline at end of file
+  over to the new key. So the old and the new key can be used in parallel.

Modified: zope.generations/trunk/src/zope/generations/README.txt
===================================================================
--- zope.generations/trunk/src/zope/generations/README.txt	2011-12-22 16:44:22 UTC (rev 123857)
+++ zope.generations/trunk/src/zope/generations/README.txt	2011-12-22 19:43:07 UTC (rev 123858)
@@ -359,3 +359,12 @@
      'four < ?': 'four < five'}
     >>> root[generations_key]['some.app']
     2
+
+The ZODB transaction log notes that our install script was executed
+
+    >>> [it.description for it in conn.db().storage.iterator()][-2]
+    u'some.app: running install generation'
+
+(Minor note: it's not the last record because there are two commits:
+MySchemaManager performs one, and evolveMinimumSubscriber performs
+the second one.  MySchemaManager doesn't really need to commit.)

Modified: zope.generations/trunk/src/zope/generations/generations.py
===================================================================
--- zope.generations/trunk/src/zope/generations/generations.py	2011-12-22 16:44:22 UTC (rev 123857)
+++ zope.generations/trunk/src/zope/generations/generations.py	2011-12-22 19:43:07 UTC (rev 123858)
@@ -278,6 +278,11 @@
       2
       >>> root.get('app2')
 
+    And that the transaction record got a note
+
+      >>> [it.description for it in conn.db().storage.iterator()][-1]
+      u'app1: evolving to generation 2'
+
     If there is an error updating a particular generation, but the
     generation is greater than the minimum generation, then we won't
     get an error from evolve, but we will get a log message.
@@ -448,6 +453,8 @@
 
                 if IInstallableSchemaManager.providedBy(manager):
                     try:
+                        transaction.get().note('%s: running install generation'
+                                               % key)
                         logger.info("%s/%s: running install generation",
                                     db_name, key)
                         manager.install(context)
@@ -491,7 +498,8 @@
             while generation < target:
                 generation += 1
                 try:
-                    transaction.begin()
+                    transaction.begin().note('%s: evolving to generation %d'
+                                             % (key, generation))
                     logger.debug('%s/%s: evolving to generation %d',
                                  db_name, key, generation)
                     manager.evolve(context, generation)



More information about the checkins mailing list