[Checkins] SVN: Products.GenericSetup/trunk/Products/GenericSetup/ Changed upgrade logic to set the current version after an upgrade to the version of the last step, instead of the current profile version.

Hanno Schlichting plone at hannosch.info
Sat Apr 12 16:16:12 EDT 2008


Log message for revision 85288:
  Changed upgrade logic to set the current version after an upgrade to the version of the last step, instead of the current profile version.
  

Changed:
  U   Products.GenericSetup/trunk/Products/GenericSetup/CHANGES.txt
  U   Products.GenericSetup/trunk/Products/GenericSetup/tool.py

-=-
Modified: Products.GenericSetup/trunk/Products/GenericSetup/CHANGES.txt
===================================================================
--- Products.GenericSetup/trunk/Products/GenericSetup/CHANGES.txt	2008-04-12 20:14:46 UTC (rev 85287)
+++ Products.GenericSetup/trunk/Products/GenericSetup/CHANGES.txt	2008-04-12 20:16:11 UTC (rev 85288)
@@ -2,6 +2,9 @@
 
   GenericSetup 1.5.0 (unreleased)
 
+    - Changed upgrade logic to set the current version after an upgrade to the
+      version of the last step, instead of the current profile version.
+
     - Use the parse_version function from pkg_resources to normalize versions
       before comparing them inside the upgrade code. This ensures pre-release
       versions are handled correctly.

Modified: Products.GenericSetup/trunk/Products/GenericSetup/tool.py
===================================================================
--- Products.GenericSetup/trunk/Products/GenericSetup/tool.py	2008-04-12 20:14:46 UTC (rev 85287)
+++ Products.GenericSetup/trunk/Products/GenericSetup/tool.py	2008-04-12 20:16:11 UTC (rev 85288)
@@ -958,6 +958,7 @@
         logger = logging.getLogger('GenericSetup')
         steps_to_run = request.form.get('upgrades', [])
         profile_id = request.get('profile_id', '')
+        step = None
         for step_id in steps_to_run:
             step = _upgrade_registry.getUpgradeStep(profile_id, step_id)
             if step is not None:
@@ -966,12 +967,10 @@
                                                               profile_id)
                 logger.log(logging.INFO, msg)
 
-        # XXX should be a bit smarter about deciding when to up the
-        #     profile version
-        profile_info = _profile_registry.getProfileInfo(profile_id)
-        version = profile_info.get('version', None)
-        if version is not None:
-            self.setLastVersionForProfile(profile_id, version)
+        # We update the profile version to the last one we have reached
+        # with runnning an upgrade step.
+        if step is not None:
+            self.setLastVersionForProfile(profile_id, step.dest)
 
         url = self.absolute_url()
         request.RESPONSE.redirect("%s/manage_upgrades?saved=%s" % (url, profile_id))



More information about the Checkins mailing list