[Zope-Checkins] CVS: Zope/lib/python/Products/PluginIndexes/TopicIndex - FilteredSet.py:1.1.2.8 TopicIndex.py:1.1.2.7
Andreas Jung
andreas@zope.com
Wed, 17 Oct 2001 08:48:19 -0400
Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/TopicIndex
In directory cvs.zope.org:/tmp/cvs-serv2653
Modified Files:
Tag: ajung-topicindex
FilteredSet.py TopicIndex.py
Log Message:
FilteredSets can now be edited through ZMI
=== Zope/lib/python/Products/PluginIndexes/TopicIndex/FilteredSet.py 1.1.2.7 => 1.1.2.8 ===
from BTrees.IIBTree import IISet
from Persistence import Persistent
-
+from Globals import DTMLFile
+from zLOG import WARNING,LOG
+import sys
class FilteredSetBase(Persistent):
@@ -115,6 +117,8 @@
def getExpression(self): return self.expr
def getIds(self): return self.ids
def getType(self): return self.meta_type
+
+ def setExpression(self, expr): self.expr = expr
def __repr__(self):
return '%s: (%s) %s' % (self.id,self.expr,map(None,self.ids))
@@ -151,7 +155,9 @@
try:
if eval(self.expr): self.ids.insert(documentId)
except:
- pass
+ LOG('FilteredSet',WARNING,'eval() failed',\
+ 'Object: %s, expr: %s' % (o.getId(),self.expr),\
+ sys.exc_info())
class CatalogFilteredSet(FilteredSetBase):
=== Zope/lib/python/Products/PluginIndexes/TopicIndex/TopicIndex.py 1.1.2.6 => 1.1.2.7 ===
- def manage_delFilteredSet(self, filterIds, URL1, \
+ def manage_delFilteredSet(self, filterIds=[], URL1=None, \
REQUEST=None,RESPONSE=None):
""" delete a list of FilteredSets"""
@@ -273,7 +273,17 @@
RESPONSE.redirect(URL1+'/manage_workspace?manage_tabs_message=FilteredSet(s)%20deleted')
- def manage_clearFilteredSet(self, filterIds, URL1, \
+ def manage_saveFilteredSet(self,filterId, expr, URL1=None,\
+ REQUEST=None,RESPONSE=None):
+ """ save expression for a FilteredSet """
+
+ self.filteredSets[filterId].setExpression(expr)
+
+ if RESPONSE:
+ RESPONSE.redirect(URL1+'/manage_workspace?manage_tabs_message=FilteredSet(s)%20updated')
+
+
+ def manage_clearFilteredSet(self, filterIds=[], URL1=None, \
REQUEST=None,RESPONSE=None):
""" clear a list of FilteredSets"""
@@ -283,7 +293,9 @@
if RESPONSE:
RESPONSE.redirect(URL1+'/manage_workspace?manage_tabs_message=FilteredSet(s)%20cleared')
- index_html = DTMLFile('dtml/index', globals())
+
+ editFilteredSet = DTMLFile('dtml/editFilteredSet',globals())
+ index_html = DTMLFile('dtml/index', globals())
manage_addTopicIndexForm = DTMLFile('dtml/addTopicIndex', globals())