[Checkins] SVN: Products.GenericSetup/trunk/Products/GenericSetup/ Deprecate some version stuff

Wichert Akkerman wichert at wiggy.net
Wed Nov 21 03:41:13 EST 2007


Log message for revision 81950:
  Deprecate some version stuff

Changed:
  U   Products.GenericSetup/trunk/Products/GenericSetup/CHANGES.txt
  U   Products.GenericSetup/trunk/Products/GenericSetup/interfaces.py
  U   Products.GenericSetup/trunk/Products/GenericSetup/registry.py

-=-
Modified: Products.GenericSetup/trunk/Products/GenericSetup/CHANGES.txt
===================================================================
--- Products.GenericSetup/trunk/Products/GenericSetup/CHANGES.txt	2007-11-20 12:44:05 UTC (rev 81949)
+++ Products.GenericSetup/trunk/Products/GenericSetup/CHANGES.txt	2007-11-21 08:41:11 UTC (rev 81950)
@@ -2,6 +2,10 @@
 
   GenericSetup 1.4 (unreleased)
   
+    - Deprecate the version field for import steps.
+
+    - Deprecate reading of version.txt to get the version for a profile.
+
     - Be more careful in checking context id validity.
 
     - Fire events before and after importing.
@@ -11,7 +15,7 @@
     - tool: Fixed toolset import handler not to initialize tools again, when
       they already exist in the site.
 
-  GenericSetup 1.3.2 (unreleased)
+  GenericSetup 1.3.2 (2007/09/11)
 
     - Ignore import and export step handlers that we can not resolve.
 

Modified: Products.GenericSetup/trunk/Products/GenericSetup/interfaces.py
===================================================================
--- Products.GenericSetup/trunk/Products/GenericSetup/interfaces.py	2007-11-20 12:44:05 UTC (rev 81949)
+++ Products.GenericSetup/trunk/Products/GenericSetup/interfaces.py	2007-11-21 08:41:11 UTC (rev 81950)
@@ -242,8 +242,8 @@
         """
 
     def registerStep( id
-                    , version
-                    , handler
+                    , version=None
+                    , handler=None
                     , dependencies=()
                     , title=None
                     , description=None
@@ -262,6 +262,8 @@
           - Attempting to register an older one after a newer one results
             in a KeyError.
 
+          NOTE: The version argument is deprecated.
+
         o 'handler' should implement IImportPlugin.
 
         o 'dependencies' is a tuple of step ids which have to run before

Modified: Products.GenericSetup/trunk/Products/GenericSetup/registry.py
===================================================================
--- Products.GenericSetup/trunk/Products/GenericSetup/registry.py	2007-11-20 12:44:05 UTC (rev 81949)
+++ Products.GenericSetup/trunk/Products/GenericSetup/registry.py	2007-11-21 08:41:11 UTC (rev 81950)
@@ -24,6 +24,7 @@
 import App.Product
 from Products.PageTemplates.PageTemplateFile import PageTemplateFile
 from zope.interface import implements
+from warnings import warn
 
 from interfaces import BASE
 from interfaces import IImportStepRegistry
@@ -168,8 +169,8 @@
     security.declarePrivate( 'registerStep' )
     def registerStep( self
                     , id
-                    , version
-                    , handler
+                    , version=None
+                    , handler=None
                     , dependencies=()
                     , title=None
                     , description=None
@@ -206,6 +207,13 @@
         """
         already = self.getStepMetadata( id )
 
+        if version is not None:
+            warn('The version parameter for registerStep.ImportStepRegistry '
+                 'is deprecated.')
+
+        if handler is None:
+            raise ValueError, 'No handler specified'
+
         if already and already[ 'version' ] > version:
             raise KeyError( 'Existing registration for step %s, version %s'
                           % ( id, already[ 'version' ] ) )
@@ -559,6 +567,9 @@
                         fhandle = open( fpath, 'r' )
                         version = fhandle.read().strip()
                         fhandle.close()
+                        warn('Version for profile %s taken from version.txt. '
+                             'This is deprecated behaviour: please specify the '
+                             'version in metadata.xml.' % profile_id)
                         break
                     except IOError:
                         continue



More information about the Checkins mailing list