[Zope-Checkins]
CVS: Zope/lib/python/Products/PluginIndexes/TopicIndex
- FilteredSet.py:1.4.6.2
Tres Seaver
tseaver at zope.com
Thu Jan 8 16:07:06 EST 2004
Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/TopicIndex
In directory cvs.zope.org:/tmp/cvs-serv6885/lib/python/Products/PluginIndexes/TopicIndex
Modified Files:
Tag: Zope-2_6-branch
FilteredSet.py
Log Message:
- FilteredSets (used within TopicIndex) are defined via an expression,
which was naievely eval'ed.
=== Zope/lib/python/Products/PluginIndexes/TopicIndex/FilteredSet.py 1.4.6.1 => 1.4.6.2 ===
--- Zope/lib/python/Products/PluginIndexes/TopicIndex/FilteredSet.py:1.4.6.1 Thu Jun 12 10:37:55 2003
+++ Zope/lib/python/Products/PluginIndexes/TopicIndex/FilteredSet.py Thu Jan 8 16:07:04 2004
@@ -17,6 +17,7 @@
from Persistence import Persistent
from Globals import DTMLFile
from zLOG import WARNING,LOG
+from RestrictedPython.Eval import RestrictionCapableEval
import sys
@@ -62,7 +63,13 @@
def index_object(self, documentId, o):
try:
- if eval(self.expr): self.ids.insert(documentId)
+ if RestrictionCapableEval(self.expr).eval({'o': o}):
+ self.ids.insert(documentId)
+ else:
+ try:
+ self.ids.remove(documentId)
+ except KeyError:
+ pass
except:
LOG('FilteredSet',WARNING,'eval() failed',\
'Object: %s, expr: %s' % (o.getId(),self.expr),\
More information about the Zope-Checkins
mailing list