[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/ - fixed checkValidId, disallowing IDs starting with '@'

Yvo Schubbe y.2006_ at wcm-solutions.de
Fri Mar 10 13:01:32 EST 2006


Log message for revision 65902:
  - fixed checkValidId, disallowing IDs starting with '@'

Changed:
  U   Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
  U   Zope/branches/Zope-2_8-branch/lib/python/OFS/ObjectManager.py
  U   Zope/branches/Zope-2_8-branch/lib/python/OFS/tests/testObjectManager.py

-=-
Modified: Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
===================================================================
--- Zope/branches/Zope-2_8-branch/doc/CHANGES.txt	2006-03-10 17:03:07 UTC (rev 65901)
+++ Zope/branches/Zope-2_8-branch/doc/CHANGES.txt	2006-03-10 18:01:31 UTC (rev 65902)
@@ -18,6 +18,9 @@
 
     Bugs fixed
 
+      - OFS ObjectManager: Fixed 'checkValidId'.
+        Names starting with '@' are reserved for views and not allowed in IDs.
+
       - Collector #2039: 'ZPublisher.HTTPRequest.HTTPRequest._authUserPW'
         choked on passwords which contained colons.
 

Modified: Zope/branches/Zope-2_8-branch/lib/python/OFS/ObjectManager.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/OFS/ObjectManager.py	2006-03-10 17:03:07 UTC (rev 65901)
+++ Zope/branches/Zope-2_8-branch/lib/python/OFS/ObjectManager.py	2006-03-10 18:01:31 UTC (rev 65902)
@@ -72,6 +72,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/branches/Zope-2_8-branch/lib/python/OFS/tests/testObjectManager.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/OFS/tests/testObjectManager.py	2006-03-10 17:03:07 UTC (rev 65901)
+++ Zope/branches/Zope-2_8-branch/lib/python/OFS/tests/testObjectManager.py	2006-03-10 18:01:31 UTC (rev 65902)
@@ -354,7 +354,9 @@
         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_suite():
     suite = unittest.TestSuite()
     suite.addTest( unittest.makeSuite( ObjectManagerTests ) )



More information about the Zope-Checkins mailing list