[Zope-Checkins] CVS: Zope2 - ZCatalog.py:1.88.6.6 convert.py:1.1.2.2
andreas@digicool.com
andreas@digicool.com
Mon, 14 May 2001 10:19:32 -0400 (EDT)
Update of /cvs-repository/Zope2/lib/python/Products/ZCatalog
In directory korak.digicool.com:/tmp/cvs-serv24516
Modified Files:
Tag: ajung-dropin-registry
ZCatalog.py convert.py
Log Message:
all index types are now pluggable
--- Updated File ZCatalog.py in package Zope2 --
--- ZCatalog.py 2001/05/11 17:05:51 1.88.6.5
+++ ZCatalog.py 2001/05/14 14:19:32 1.88.6.6
@@ -244,19 +244,19 @@
self._catalog.replaceIndexes(indexes)
self._catalog.addColumn('id')
- self._catalog.addIndex('id', 'FieldIndex')
+ self._catalog.addIndex('id', 'PluggableFieldIndex')
-# self._catalog.addColumn('title')
-# self._catalog.addIndex('title', 'PluggableTextIndex')
+ self._catalog.addColumn('title')
+ self._catalog.addIndex('title', 'PluggableTextIndex')
self._catalog.addColumn('meta_type')
- self._catalog.addIndex('meta_type', 'FieldIndex')
+ self._catalog.addIndex('meta_type', 'PluggableFieldIndex')
self._catalog.addColumn('bobobase_modification_time')
- self._catalog.addIndex('bobobase_modification_time', 'FieldIndex')
+ self._catalog.addIndex('bobobase_modification_time', 'PluggableFieldIndex')
self._catalog.addColumn('summary')
- self._catalog.addIndex('PrincipiaSearchSource', 'TextIndex')
+ self._catalog.addIndex('PrincipiaSearchSource', 'PluggableTextIndex')
self._catalog.addIndex('path','PluggablePathIndex')
--- Updated File convert.py in package Zope2 --
--- convert.py 2001/05/11 20:00:33 1.1.2.1
+++ convert.py 2001/05/14 14:19:32 1.1.2.2
@@ -1,5 +1,9 @@
#!/usr/bin/env python2.1
+import Zope
+from OFS import FindSupport
+from Vocabulary import Vocabulary
+from ZCatalogIndexes import ZCatalogIndexes
lst = []
@@ -9,17 +13,38 @@
if obj.meta_type=='Folder':
lst.extend(findCatalogs(obj.objectItems()))
if obj.meta_type=='ZCatalog':
- lst.append((id,obj))
+ if not ((id,obj)) in lst: lst.append((id,obj))
return lst
-import Zope
-from OFS import FindSupport
+
+def convertCatalog(id,cat):
+ print id,cat
+
+ try:
+ indexes = cat.Indexes._indexes
+ print "Catalog ok"
+ return
+ except:
+ indexes = cat._catalog.indexes
+ print "Catalog not ok"
+
+ v = Vocabulary('Vocabulary', 'Vocabulary', globbing=1)
+
+ indexes = ZCatalogIndexes('Indexes',vocabulary=cat.vocab_id,caller=None)
+ cat._setObject('Indexes', indexes)
+
+ for idx,obj in indexes.items():
+ print idx,obj.meta_type
+
+ get_transaction().commit()
+
+
app = Zope.app()
catalogs = findCatalogs(app.objectItems())
-for c in catalogs:
- print c,c[1].getPhysicalPath()
+for id,cat in catalogs:
+ convertCatalog(id,cat)