[Zope-Checkins] SVN: Zope/trunk/lib/python/ZPublisher/ Merged Zope
2.9 branch r41704:41705 into the trunk.
Stefan H. Holek
stefan at epy.co.at
Sun Feb 19 13:46:58 EST 2006
Log message for revision 41706:
Merged Zope 2.9 branch r41704:41705 into the trunk.
Prevent publishing of Python 2.4's 'set' and 'frozenset' types.
Changed:
U Zope/trunk/lib/python/ZPublisher/BaseRequest.py
U Zope/trunk/lib/python/ZPublisher/tests/testBaseRequest.py
-=-
Modified: Zope/trunk/lib/python/ZPublisher/BaseRequest.py
===================================================================
--- Zope/trunk/lib/python/ZPublisher/BaseRequest.py 2006-02-19 18:44:27 UTC (rev 41705)
+++ Zope/trunk/lib/python/ZPublisher/BaseRequest.py 2006-02-19 18:46:57 UTC (rev 41706)
@@ -579,6 +579,10 @@
if hasattr(types, name):
itypes[getattr(types, name)] = 0
+# Python 2.4 no longer maintains the types module.
+itypes[set] = 0
+itypes[frozenset] = 0
+
def typeCheck(obj, deny=itypes):
# Return true if its ok to publish the type, false otherwise.
return deny.get(type(obj), 1)
Modified: Zope/trunk/lib/python/ZPublisher/tests/testBaseRequest.py
===================================================================
--- Zope/trunk/lib/python/ZPublisher/tests/testBaseRequest.py 2006-02-19 18:44:27 UTC (rev 41705)
+++ Zope/trunk/lib/python/ZPublisher/tests/testBaseRequest.py 2006-02-19 18:46:57 UTC (rev 41706)
@@ -102,6 +102,8 @@
self.f1.simpleList = []
self.f1.simpleBoolean = True
self.f1.simpleComplex = complex(1)
+ self.f1.simpleSet = set([])
+ self.f1.simpleFrozenSet = frozenset([])
def makeBaseRequest(self):
response = HTTPResponse()
@@ -239,7 +241,13 @@
self.assertRaises(NotFound, r.traverse, 'folder/simpleBoolean')
self.assertRaises(NotFound, r.traverse, 'folder/simpleComplex')
+ def test_traverse_set_type(self):
+ from ZPublisher import NotFound
+ r = self.makeBaseRequest()
+ self.assertRaises(NotFound, r.traverse, 'folder/simpleSet')
+ self.assertRaises(NotFound, r.traverse, 'folder/simpleFrozenSet')
+
def test_suite():
return TestSuite( ( makeSuite(TestBaseRequest), ) )
More information about the Zope-Checkins
mailing list