[Checkins] SVN: GenericSetup/trunk/ - implemented the 'remove'
directive for indexes
Yvo Schubbe
y.2006_ at wcm-solutions.de
Thu Apr 6 15:11:09 EDT 2006
Log message for revision 66608:
- implemented the 'remove' directive for indexes
Changed:
U GenericSetup/trunk/CHANGES.txt
U GenericSetup/trunk/ZCatalog/exportimport.py
U GenericSetup/trunk/ZCatalog/tests/test_exportimport.py
-=-
Modified: GenericSetup/trunk/CHANGES.txt
===================================================================
--- GenericSetup/trunk/CHANGES.txt 2006-04-06 19:09:02 UTC (rev 66607)
+++ GenericSetup/trunk/CHANGES.txt 2006-04-06 19:11:09 UTC (rev 66608)
@@ -2,8 +2,11 @@
GenericSetup 1.1 (unreleased)
- - getExportStepRegistry had the wrong security declaration
+ - ZCatalog handler: Implemented the 'remove' directive for indexes.
+ This allows to write extension profiles that remove or replace indexes.
+ - getExportStepRegistry had the wrong security declaration
+
GenericSetup 1.1-beta2 (2006/03/26)
No changes - tag created to coincide with CMF 2.0.0-beta2
Modified: GenericSetup/trunk/ZCatalog/exportimport.py
===================================================================
--- GenericSetup/trunk/ZCatalog/exportimport.py 2006-04-06 19:09:02 UTC (rev 66607)
+++ GenericSetup/trunk/ZCatalog/exportimport.py 2006-04-06 19:11:09 UTC (rev 66608)
@@ -93,6 +93,10 @@
zcatalog = self.context
idx_id = str(child.getAttribute('name'))
+ if child.hasAttribute('remove'):
+ zcatalog.delIndex(idx_id)
+ continue
+
if idx_id not in zcatalog.indexes():
extra = _extra()
for sub in child.childNodes:
Modified: GenericSetup/trunk/ZCatalog/tests/test_exportimport.py
===================================================================
--- GenericSetup/trunk/ZCatalog/tests/test_exportimport.py 2006-04-06 19:09:02 UTC (rev 66607)
+++ GenericSetup/trunk/ZCatalog/tests/test_exportimport.py 2006-04-06 19:11:09 UTC (rev 66608)
@@ -68,6 +68,19 @@
</object>
"""
+_CATALOG_UPDATE_BODY = """\
+<?xml version="1.0"?>
+<object name="foo_catalog">
+ <object name="foo_vocabulary" remove="True"/>
+ <index name="foo_text" remove="True"/>
+ <index name="foo_text" meta_type="ZCTextIndex">
+ <indexed_attr value="foo_text"/>
+ <extra name="index_type" value="Okapi BM25 Rank"/>
+ <extra name="lexicon_id" value="foo_plexicon"/>
+ </index>
+</object>
+"""
+
_TEXT_XML = """\
<index name="foo_text" meta_type="TextIndex" deprecated="True"/>
"""
@@ -76,7 +89,15 @@
<object name="foo_vocabulary" meta_type="Vocabulary" deprecated="True"/>
"""
+_ZCTEXT_XML = """\
+ <index name="foo_text" meta_type="ZCTextIndex">
+ <indexed_attr value="foo_text"/>
+ <extra name="index_type" value="Okapi BM25 Rank"/>
+ <extra name="lexicon_id" value="foo_plexicon"/>
+ </index>
+"""
+
class ZCatalogXMLAdapterTests(BodyAdapterTestCase):
def _getTargetClass(self):
@@ -153,7 +174,15 @@
self.assertEqual(adapted.body,
_CATALOG_BODY % (_VOCABULARY_XML, _TEXT_XML))
+ def test_body_set_update(self):
+ self._populate_special(self._obj)
+ context = DummySetupEnviron()
+ context._should_purge = False
+ adapted = getMultiAdapter((self._obj, context), IBody)
+ adapted.body = _CATALOG_UPDATE_BODY
+ self.assertEqual(adapted.body, _CATALOG_BODY % ('', _ZCTEXT_XML))
+
def test_suite():
return unittest.TestSuite((
unittest.makeSuite(ZCatalogXMLAdapterTests),
More information about the Checkins
mailing list