[CMF-checkins] SVN: CMF/branches/1.5/C Merge revision 38406 from trunk, and update CHANGES:

Florent Guillaume fg at nuxeo.com
Thu Sep 8 13:47:29 EDT 2005


Log message for revision 38407:
  Merge revision 38406 from trunk, and update CHANGES:
  
    Allow export of old instances of list properties (instead of tuples).
  
  

Changed:
  U   CMF/branches/1.5/CHANGES.txt
  U   CMF/branches/1.5/CMFSetup/tests/test_properties.py
  U   CMF/branches/1.5/CMFSetup/utils.py

-=-
Modified: CMF/branches/1.5/CHANGES.txt
===================================================================
--- CMF/branches/1.5/CHANGES.txt	2005-09-08 17:43:57 UTC (rev 38406)
+++ CMF/branches/1.5/CHANGES.txt	2005-09-08 17:47:28 UTC (rev 38407)
@@ -15,6 +15,9 @@
       specify another catalog or workflow tool the content type can
       use
 
+    - CMFSetup: allow export of properties of old objects that were
+      stored as lists (instead of tuples now).
+
 CMF 1.5.4 (2005/09/04)
 
   Bug Fixes

Modified: CMF/branches/1.5/CMFSetup/tests/test_properties.py
===================================================================
--- CMF/branches/1.5/CMFSetup/tests/test_properties.py	2005-09-08 17:43:57 UTC (rev 38406)
+++ CMF/branches/1.5/CMFSetup/tests/test_properties.py	2005-09-08 17:47:28 UTC (rev 38407)
@@ -42,6 +42,8 @@
   <property name="foo" type="string">Foo</property>
   <property name="bar" type="tokens">
    <element value="Bar"/></property>
+  <property name="moo" type="tokens">
+   <element value="Moo"/></property>
 </site>
 """
 
@@ -65,8 +67,10 @@
 
         if bar > 0:
             site._setProperty( 'bar', (), 'tokens' )
+            site._setProperty( 'moo', (), 'tokens' )
         if bar > 1:
             site._updateProperty( 'bar', ('Bar',) )
+            site.moo = ['Moo']
 
         return site
 
@@ -91,6 +95,11 @@
                        'value': '',
                        'elements': ('Bar',),
                        'type': 'tokens',
+                       'select_variable': None },
+                     { 'id': 'moo',
+                       'value': '',
+                       'elements': ('Moo',),
+                       'type': 'tokens',
                        'select_variable': None } ]
 
         configurator = self._makeOne(site)
@@ -129,7 +138,7 @@
         configurator = self._makeOne(site)
         site_info = configurator.parseXML(_NORMAL_EXPORT)
 
-        self.assertEqual( len( site_info['properties'] ), 2 )
+        self.assertEqual( len( site_info['properties'] ), 3 )
 
         info = site_info['properties'][0]
         self.assertEqual( info['id'], 'foo' )
@@ -180,7 +189,7 @@
 
         site = self._initSite()
 
-        self.assertEqual( len( site.propertyIds() ), 2 )
+        self.assertEqual( len( site.propertyIds() ), 3 )
         self.failUnless( 'foo' in site.propertyIds() )
         self.assertEqual( site.getProperty('foo'), 'Foo' )
         self.failUnless( 'bar' in site.propertyIds() )
@@ -198,7 +207,7 @@
 
         site = self._initSite()
 
-        self.assertEqual( len( site.propertyIds() ), 2 )
+        self.assertEqual( len( site.propertyIds() ), 3 )
         self.failUnless( 'foo' in site.propertyIds() )
         self.assertEqual( site.getProperty('foo'), 'Foo' )
         self.failUnless( 'bar' in site.propertyIds() )
@@ -216,7 +225,7 @@
 
         site = self._initSite()
 
-        self.assertEqual( len( site.propertyIds() ), 2 )
+        self.assertEqual( len( site.propertyIds() ), 3 )
         self.failUnless( 'foo' in site.propertyIds() )
         self.assertEqual( site.getProperty('foo'), 'Foo' )
         self.failUnless( 'bar' in site.propertyIds() )
@@ -228,7 +237,7 @@
         from Products.CMFSetup.properties import importSiteProperties
         importSiteProperties(context)
 
-        self.assertEqual( len( site.propertyIds() ), 2 )
+        self.assertEqual( len( site.propertyIds() ), 3 )
         self.failUnless( 'foo' in site.propertyIds() )
         self.assertEqual( site.getProperty('foo'), 'Foo' )
         self.failUnless( 'bar' in site.propertyIds() )
@@ -246,7 +255,7 @@
         from Products.CMFSetup.properties import importSiteProperties
         importSiteProperties(context)
 
-        self.assertEqual( len( site.propertyIds() ), 2 )
+        self.assertEqual( len( site.propertyIds() ), 3 )
         self.failUnless( 'foo' in site.propertyIds() )
         self.assertEqual( site.getProperty('foo'), 'Foo' )
         self.failUnless( 'bar' in site.propertyIds() )
@@ -264,7 +273,7 @@
         from Products.CMFSetup.properties import importSiteProperties
         importSiteProperties(context)
 
-        self.assertEqual( len( site.propertyIds() ), 2 )
+        self.assertEqual( len( site.propertyIds() ), 3 )
         self.failUnless( 'foo' in site.propertyIds() )
         self.assertEqual( site.getProperty('foo'), 'Foo' )
         self.failUnless( 'bar' in site.propertyIds() )

Modified: CMF/branches/1.5/CMFSetup/utils.py
===================================================================
--- CMF/branches/1.5/CMFSetup/utils.py	2005-09-08 17:43:57 UTC (rev 38406)
+++ CMF/branches/1.5/CMFSetup/utils.py	2005-09-08 17:47:28 UTC (rev 38407)
@@ -374,6 +374,11 @@
         if isinstance(prop, tuple):
             prop_value = ''
             prop_elements = prop
+        elif isinstance(prop, list):
+            # Backward compat for old instances that stored
+            # properties as list.
+            prop_value = ''
+            prop_elements = tuple(prop)
         else:
             prop_value = prop
             prop_elements = ()



More information about the CMF-checkins mailing list