[Zope-Checkins] SVN: Zope/trunk/lib/python/OFS/ - fixed
checkValidId, disallowing IDs starting with '@'
Yvo Schubbe
y.2006_ at wcm-solutions.de
Fri Mar 10 13:02:00 EST 2006
Log message for revision 65904:
- fixed checkValidId, disallowing IDs starting with '@'
Changed:
U Zope/trunk/lib/python/OFS/ObjectManager.py
U Zope/trunk/lib/python/OFS/tests/testObjectManager.py
-=-
Modified: Zope/trunk/lib/python/OFS/ObjectManager.py
===================================================================
--- Zope/trunk/lib/python/OFS/ObjectManager.py 2006-03-10 18:01:49 UTC (rev 65903)
+++ Zope/trunk/lib/python/OFS/ObjectManager.py 2006-03-10 18:01:59 UTC (rev 65904)
@@ -89,6 +89,9 @@
'The id "%s" is invalid because it begins with "aq_".' % id)
if id.endswith('__'): raise BadRequest, (
'The id "%s" is invalid because it ends with two underscores.' % id)
+ if id[0] == '@':
+ raise BadRequest('The id "%s" is invalid because it begins with '
+ '"@".' % id)
if not allow_dup:
obj = getattr(self, id, None)
if obj is not None:
Modified: Zope/trunk/lib/python/OFS/tests/testObjectManager.py
===================================================================
--- Zope/trunk/lib/python/OFS/tests/testObjectManager.py 2006-03-10 18:01:49 UTC (rev 65903)
+++ Zope/trunk/lib/python/OFS/tests/testObjectManager.py 2006-03-10 18:01:59 UTC (rev 65904)
@@ -378,6 +378,7 @@
self.assertRaises(BadRequest, om._setObject, '111', si)
self.assertRaises(BadRequest, om._setObject, 'REQUEST', si)
self.assertRaises(BadRequest, om._setObject, '/', si)
+ self.assertRaises(BadRequest, om._setObject, '@@view', si)
def test_list_imports(self):
om = self._makeOne()
@@ -389,6 +390,7 @@
self.failUnless(filename.endswith('.zexp') or
filename.endswith('.xml'))
+
def test_suite():
suite = unittest.TestSuite()
suite.addTest( unittest.makeSuite( ObjectManagerTests ) )
More information about the Zope-Checkins
mailing list