[Zope-Checkins] CVS: Zope2 - ZCatalog.py:1.88.6.12
Matthew T. Kromer
matt@digicool.com
Wed, 23 May 2001 11:50:42 -0400 (EDT)
Update of /cvs-repository/Zope2/lib/python/Products/ZCatalog
In directory korak.digicool.com:/tmp/cvs-serv12960/ZCatalog
Modified Files:
Tag: ajung-dropin-registry
ZCatalog.py
Log Message:
Fix some buttons (manage reindex, delete, & clear) at the bottom of Indexes page
--- Updated File ZCatalog.py in package Zope2 --
--- ZCatalog.py 2001/05/21 21:34:57 1.88.6.11
+++ ZCatalog.py 2001/05/23 15:50:42 1.88.6.12
@@ -406,14 +406,35 @@
if REQUEST and RESPONSE:
RESPONSE.redirect(URL1 + '/manage_main?manage_tabs_message=Index%20Added')
- def manage_delIndexes(self, names, REQUEST=None, RESPONSE=None, URL1=None):
+
+ def manage_deleteIndex(self, ids=None, REQUEST=None, RESPONSE=None,
+ URL1=None):
""" del an index """
- for name in names:
+ if not ids:
+ return MessageDialog(title='No items specified',
+ message='No items were specified!',
+ action = "./manage_main",)
+
+ for name in ids:
self.delIndex(name)
if REQUEST and RESPONSE:
RESPONSE.redirect(URL1 + '/manage_main?manage_tabs_message=Index%20Deleted')
+ def manage_clearIndex(self, ids=None, REQUEST=None, RESPONSE=None,
+ URL1=None):
+ """ del an index """
+ if not ids:
+ return MessageDialog(title='No items specified',
+ message='No items were specified!',
+ action = "./manage_main",)
+
+ for name in ids:
+ self.clearIndex(name)
+
+ if REQUEST and RESPONSE:
+ RESPONSE.redirect(URL1 + '/manage_main?manage_tabs_message=Index%20Cleared')
+
def reindexIndex(self,name,REQUEST):
print "please reindex",name
@@ -428,6 +449,18 @@
if obj is not None:
self.catalog_object(obj, p, idxs=[name])
+ def manage_reindexIndex(self, ids=None, REQUEST=None, RESPONSE=None, URL1=None):
+ """ Reindex indexes from a ZCatalog"""
+ if not ids:
+ return MessageDialog(title='No items specified',
+ message='No items were specified!',
+ action = "./manage_main",)
+
+ for id in ids:
+ self.reindexIndex(id, REQUEST)
+
+ if REQUEST and RESPONSE:
+ RESPONSE.redirect(URL1 + '/manage_main?manage_tabs_message=Reindexing%20Performed')
def catalog_object(self, obj, uid=None, idxs=[]):
""" wrapper around catalog """
@@ -787,6 +820,11 @@
print "del index %s" % (name)
self._catalog.delIndex(name)
+
+ def clearIndex(self, name):
+ print "clear index %s" % name
+
+ self._catalog.indexes[name].clear()
def addColumn(self, name, default_value=None):