[Checkins] SVN: Products.GenericSetup/trunk/Products/GenericSetup/ - implemented useful behavior for steps that have source/destination versions *and* a checker specified

Yvo Schubbe y.2008 at wcm-solutions.de
Tue Dec 23 14:50:17 EST 2008


Log message for revision 94296:
  - implemented useful behavior for steps that have source/destination versions *and* a checker specified

Changed:
  U   Products.GenericSetup/trunk/Products/GenericSetup/CHANGES.txt
  U   Products.GenericSetup/trunk/Products/GenericSetup/tests/upgrade.txt
  U   Products.GenericSetup/trunk/Products/GenericSetup/tool.py
  U   Products.GenericSetup/trunk/Products/GenericSetup/upgrade.py
  U   Products.GenericSetup/trunk/Products/GenericSetup/www/upgradeStep.zpt

-=-
Modified: Products.GenericSetup/trunk/Products/GenericSetup/CHANGES.txt
===================================================================
--- Products.GenericSetup/trunk/Products/GenericSetup/CHANGES.txt	2008-12-23 19:10:46 UTC (rev 94295)
+++ Products.GenericSetup/trunk/Products/GenericSetup/CHANGES.txt	2008-12-23 19:50:17 UTC (rev 94296)
@@ -5,6 +5,8 @@
 -------------------------------
 
 - UpgradeSteps: Improved listUpgradeSteps behavior.
+  If versions and checker are specified for a step, the checker is used as an
+  additional restriction.
 
 - Don't fail when a sub-item cannot be adapted after creation when
   importing a folder.  (https://bugs.launchpad.net/zope-cmf/+bug/300315)

Modified: Products.GenericSetup/trunk/Products/GenericSetup/tests/upgrade.txt
===================================================================
--- Products.GenericSetup/trunk/Products/GenericSetup/tests/upgrade.txt	2008-12-23 19:10:46 UTC (rev 94295)
+++ Products.GenericSetup/trunk/Products/GenericSetup/tests/upgrade.txt	2008-12-23 19:50:17 UTC (rev 94296)
@@ -208,7 +208,6 @@
             >>> bool(_extractStepInfo(tool, 'ID', e, '1.0'))
             True
 
-
         2.0 == 2.0 < 3.0
 
             >>> e.versionMatch('2.0')
@@ -310,9 +309,9 @@
             >>> e.versionMatch('2.0')
             False
             >>> e.isProposed(tool, '2.0')
-            True
+            False
             >>> bool(_extractStepInfo(tool, 'ID', e, '2.0'))
-            True
+            False
 
     with combined restrictions: 1.1 -> 2.0, true checker
     ----------------------------------------------------
@@ -333,7 +332,7 @@
             >>> e.versionMatch('1.0')
             False
             >>> e.isProposed(tool, '1.0')
-            True
+            False
             >>> bool(_extractStepInfo(tool, 'ID', e, '1.0'))
             True
 
@@ -342,9 +341,9 @@
             >>> e.versionMatch('2.0')
             False
             >>> e.isProposed(tool, '2.0')
-            True
+            False
             >>> bool(_extractStepInfo(tool, 'ID', e, '2.0'))
-            True
+            False
 
     with combined restrictions: 2.0 -> 3.0, true checker
     ----------------------------------------------------
@@ -365,7 +364,7 @@
             >>> e.versionMatch('1.0')
             False
             >>> e.isProposed(tool, '1.0')
-            True
+            False
             >>> bool(_extractStepInfo(tool, 'ID', e, '1.0'))
             True
 

Modified: Products.GenericSetup/trunk/Products/GenericSetup/tool.py
===================================================================
--- Products.GenericSetup/trunk/Products/GenericSetup/tool.py	2008-12-23 19:10:46 UTC (rev 94295)
+++ Products.GenericSetup/trunk/Products/GenericSetup/tool.py	2008-12-23 19:50:17 UTC (rev 94296)
@@ -837,6 +837,9 @@
         info['haspath'] = info['source'] and info['dest']
         info['ssource'] = '.'.join(info['source'] or ('all',))
         info['sdest'] = '.'.join(info['dest'] or ('all',))
+        info['done'] = (not info['proposed'] and
+                        info['step'].checker is not None and
+                        not info['step'].checker(self))
         return info
 
     security.declareProtected(ManagePortal, 'listUpgrades')
@@ -878,7 +881,7 @@
 
         # We update the profile version to the last one we have reached
         # with running an upgrade step.
-        if step.dest is not None:
+        if step.dest is not None and step.checker is None:
             self.setLastVersionForProfile(profile_id, step.dest)
 
         url = self.absolute_url()

Modified: Products.GenericSetup/trunk/Products/GenericSetup/upgrade.py
===================================================================
--- Products.GenericSetup/trunk/Products/GenericSetup/upgrade.py	2008-12-23 19:10:46 UTC (rev 94295)
+++ Products.GenericSetup/trunk/Products/GenericSetup/upgrade.py	2008-12-23 19:50:17 UTC (rev 94296)
@@ -124,8 +124,7 @@
         checker = self.checker
         if checker is None:
             return self.versionMatch(source)
-        else:
-            return checker(tool)
+        return self.versionMatch(source) and checker(tool)
 
 
 class UpgradeStep(UpgradeEntity):

Modified: Products.GenericSetup/trunk/Products/GenericSetup/www/upgradeStep.zpt
===================================================================
--- Products.GenericSetup/trunk/Products/GenericSetup/www/upgradeStep.zpt	2008-12-23 19:10:46 UTC (rev 94295)
+++ Products.GenericSetup/trunk/Products/GenericSetup/www/upgradeStep.zpt	2008-12-23 19:50:17 UTC (rev 94296)
@@ -12,11 +12,10 @@
       <div tal:replace="info/title">INFO</div>
     </td>
     <td class="form-help">
-      <div tal:condition="info/haspath"
-           tal:content="structure string:(${info/ssource} &amp;#8594; ${info/sdest})">PATH</div>
+      <div tal:content="structure string:(${info/ssource} &amp;#8594; ${info/sdest})">PATH</div>
     </td>
     <td class="form-help">
-      <div tal:condition="not:info/proposed"
+      <div tal:condition="info/done"
            tal:replace="default">(done)</div>
     </td>
   </metal:upgrade-step>



More information about the Checkins mailing list