Log message for revision 41705: Also prevent publishing of Python 2.4's 'set' and 'frozenset' types.
Changed: U Zope/branches/2.9/lib/python/ZPublisher/BaseRequest.py U Zope/branches/2.9/lib/python/ZPublisher/tests/testBaseRequest.py -=- Modified: Zope/branches/2.9/lib/python/ZPublisher/BaseRequest.py =================================================================== --- Zope/branches/2.9/lib/python/ZPublisher/BaseRequest.py 2006-02-19 16:10:38 UTC (rev 41704) +++ Zope/branches/2.9/lib/python/ZPublisher/BaseRequest.py 2006-02-19 18:44:27 UTC (rev 41705) @@ -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/branches/2.9/lib/python/ZPublisher/tests/testBaseRequest.py =================================================================== --- Zope/branches/2.9/lib/python/ZPublisher/tests/testBaseRequest.py 2006-02-19 16:10:38 UTC (rev 41704) +++ Zope/branches/2.9/lib/python/ZPublisher/tests/testBaseRequest.py 2006-02-19 18:44:27 UTC (rev 41705) @@ -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), ) ) _______________________________________________ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins