[Zope-CVS] SVN: GenericSetup/trunk/ - made sure each FilteredSet is only added once

Yvo Schubbe y.2006_ at wcm-solutions.de
Wed Jan 25 13:32:47 EST 2006


Log message for revision 41445:
  - made sure each FilteredSet is only added once
  - improved AdapterTestCases to make sure repeated imports of the same profile don't change the result

Changed:
  U   GenericSetup/trunk/PluginIndexes/exportimport.py
  U   GenericSetup/trunk/testing.py

-=-
Modified: GenericSetup/trunk/PluginIndexes/exportimport.py
===================================================================
--- GenericSetup/trunk/PluginIndexes/exportimport.py	2006-01-25 18:11:32 UTC (rev 41444)
+++ GenericSetup/trunk/PluginIndexes/exportimport.py	2006-01-25 18:32:47 UTC (rev 41445)
@@ -208,8 +208,9 @@
         for child in node.childNodes:
             if child.nodeName == 'filtered_set':
                 set_id = str(child.getAttribute('name'))
-                set_meta_type = str(child.getAttribute('meta_type'))
-                self.context.addFilteredSet(set_id, set_meta_type, '')
+                if set_id not in self.context.filteredSets:
+                    set_meta_type = str(child.getAttribute('meta_type'))
+                    self.context.addFilteredSet(set_id, set_meta_type, '')
                 set = self.context.filteredSets[set_id]
                 importer = zapi.queryMultiAdapter((set, self.environ), INode)
                 importer.node = child

Modified: GenericSetup/trunk/testing.py
===================================================================
--- GenericSetup/trunk/testing.py	2006-01-25 18:11:32 UTC (rev 41444)
+++ GenericSetup/trunk/testing.py	2006-01-25 18:32:47 UTC (rev 41445)
@@ -99,7 +99,19 @@
         self._verifyImport(self._obj)
         self.assertEqual(adapted.body, self._BODY)
 
+        # now in update mode
+        context._should_purge = False
+        adapted = zapi.getMultiAdapter((self._obj, context), IBody)
+        adapted.body = self._BODY
+        self._verifyImport(self._obj)
+        self.assertEqual(adapted.body, self._BODY)
 
+        # and again in update mode
+        adapted = zapi.getMultiAdapter((self._obj, context), IBody)
+        adapted.body = self._BODY
+        self._verifyImport(self._obj)
+        self.assertEqual(adapted.body, self._BODY)
+
 class NodeAdapterTestCase(_AdapterTestCaseBase):
 
     def test_z3interfaces(self):
@@ -117,3 +129,16 @@
         adapted.node = parseString(self._XML).documentElement
         self._verifyImport(self._obj)
         self.assertEqual(adapted.node.toprettyxml(' '), self._XML)
+
+        # now in update mode
+        context._should_purge = False
+        adapted = zapi.getMultiAdapter((self._obj, context), INode)
+        adapted.node = parseString(self._XML).documentElement
+        self._verifyImport(self._obj)
+        self.assertEqual(adapted.node.toprettyxml(' '), self._XML)
+
+        # and again in update mode
+        adapted = zapi.getMultiAdapter((self._obj, context), INode)
+        adapted.node = parseString(self._XML).documentElement
+        self._verifyImport(self._obj)
+        self.assertEqual(adapted.node.toprettyxml(' '), self._XML)



More information about the Zope-CVS mailing list