[Checkins] SVN: GenericSetup/branches/1.2/ - don't raise an error
if index is already removed (patch contributed by Maurits)
Yvo Schubbe
y.2007- at wcm-solutions.de
Mon Apr 9 12:07:35 EDT 2007
Log message for revision 74050:
- don't raise an error if index is already removed (patch contributed by Maurits)
- clear DOM in _exportBody after using it
Changed:
U GenericSetup/branches/1.2/CHANGES.txt
U GenericSetup/branches/1.2/ZCatalog/exportimport.py
U GenericSetup/branches/1.2/ZCatalog/tests/test_exportimport.py
U GenericSetup/branches/1.2/utils.py
-=-
Modified: GenericSetup/branches/1.2/CHANGES.txt
===================================================================
--- GenericSetup/branches/1.2/CHANGES.txt 2007-04-09 15:34:17 UTC (rev 74049)
+++ GenericSetup/branches/1.2/CHANGES.txt 2007-04-09 16:07:34 UTC (rev 74050)
@@ -1,6 +1,14 @@
GenericSetup Product Changelog
- - No longer read the toolset xml and update the toolset regustry on
+ GenericSetup 1.2 (unreleased)
+
+ - ZCatalog handler: Fixed 'remove' behavior.
+ If the index doesn't exist, removing no longer raises an error.
+
+ - utils: Fixed XMLAdapterBase.
+ Exporting the XML body worked only once per instance.
+
+ - No longer read the toolset xml and update the toolset registry on
import context change. Doing this only during the toolset step import
should be sufficient.
Modified: GenericSetup/branches/1.2/ZCatalog/exportimport.py
===================================================================
--- GenericSetup/branches/1.2/ZCatalog/exportimport.py 2007-04-09 15:34:17 UTC (rev 74049)
+++ GenericSetup/branches/1.2/ZCatalog/exportimport.py 2007-04-09 16:07:34 UTC (rev 74050)
@@ -94,7 +94,11 @@
idx_id = str(child.getAttribute('name'))
if child.hasAttribute('remove'):
- zcatalog.delIndex(idx_id)
+ # Remove index if it is there; then continue to the next
+ # index. Removing a non existing index should not cause an
+ # error, so you can apply the profile twice without problems.
+ if idx_id in zcatalog.indexes():
+ zcatalog.delIndex(idx_id)
continue
if idx_id not in zcatalog.indexes():
Modified: GenericSetup/branches/1.2/ZCatalog/tests/test_exportimport.py
===================================================================
--- GenericSetup/branches/1.2/ZCatalog/tests/test_exportimport.py 2007-04-09 15:34:17 UTC (rev 74049)
+++ GenericSetup/branches/1.2/ZCatalog/tests/test_exportimport.py 2007-04-09 16:07:34 UTC (rev 74050)
@@ -77,6 +77,7 @@
<extra name="index_type" value="Okapi BM25 Rank"/>
<extra name="lexicon_id" value="foo_plexicon"/>
</index>
+ <index name="non_existing" remove="True"/>
</object>
"""
Modified: GenericSetup/branches/1.2/utils.py
===================================================================
--- GenericSetup/branches/1.2/utils.py 2007-04-09 15:34:17 UTC (rev 74049)
+++ GenericSetup/branches/1.2/utils.py 2007-04-09 16:07:34 UTC (rev 74050)
@@ -501,7 +501,9 @@
"""Export the object as a file body.
"""
self._doc.appendChild(self._exportNode())
- return self._doc.toprettyxml(' ')
+ xml = self._doc.toprettyxml(' ')
+ self._doc.unlink()
+ return xml
def _importBody(self, body):
"""Import the object from the file body.
More information about the Checkins
mailing list