[CMF-checkins] SVN: CMF/trunk/CMFCore/ - IDs starting with '@@' are now reserved for views

Yvo Schubbe y.2006_ at wcm-solutions.de
Fri Mar 24 06:26:02 EST 2006


Log message for revision 66145:
  - IDs starting with '@@' are now reserved for views

Changed:
  U   CMF/trunk/CMFCore/PortalFolder.py
  U   CMF/trunk/CMFCore/tests/test_PortalFolder.py

-=-
Modified: CMF/trunk/CMFCore/PortalFolder.py
===================================================================
--- CMF/trunk/CMFCore/PortalFolder.py	2006-03-24 11:25:41 UTC (rev 66144)
+++ CMF/trunk/CMFCore/PortalFolder.py	2006-03-24 11:26:02 UTC (rev 66145)
@@ -339,6 +339,11 @@
         if id == 'syndication_information':
             return
 
+        # IDs starting with '@@' are reserved for views.
+        if id[:2] == '@@':
+            raise BadRequest('The id "%s" is invalid because it begins with '
+                             '"@@".' % id)
+
         # This code prevents people other than the portal manager from
         # overriding skinned names and tools.
         if not getSecurityManager().checkPermission(ManagePortal, self):

Modified: CMF/trunk/CMFCore/tests/test_PortalFolder.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_PortalFolder.py	2006-03-24 11:25:41 UTC (rev 66144)
+++ CMF/trunk/CMFCore/tests/test_PortalFolder.py	2006-03-24 11:26:02 UTC (rev 66145)
@@ -252,9 +252,7 @@
         wftool.notifyCreated(test)
         self.assertEqual( len(ctool), 0 )
 
-
     def test_tracker261(self):
-
         #
         #   Tracker issue #261 says that content in a deleted folder
         #   is not being uncatalogued.  Try creating a subfolder with
@@ -401,14 +399,6 @@
         newSecurityManager(None, acl_users.user_foo)
         self.assertRaises(BadRequest, test._checkId, 'view.html')
 
-    def test_checkIdAvailableCatchesBadRequest(self):
-        #
-        #   checkIdAvailable() should catch BadRequest
-        #
-        test = self._makeOne('test')
-        test._setObject('foo', DummyContent('foo'))
-        self.failIf(test.checkIdAvailable('foo'))
-
     def test__checkId_starting_with_dot(self):
         #
         # doted prefixed names at the root of the portal can be overriden
@@ -427,6 +417,20 @@
 
         self.assert_(sub.checkIdAvailable('.foo'))
 
+    def test__checkId_Five(self):
+        test = self._makeOne('test')
+        self.assertRaises(BadRequest, test._checkId, '@@view.html')
+        self.assertRaises(BadRequest, test._checkId, '++resource++icon.png')
+
+    def test_checkIdAvailableCatchesBadRequest(self):
+        #
+        #   checkIdAvailable() should catch BadRequest
+        #
+        test = self._makeOne('test')
+        test._setObject('foo', DummyContent('foo'))
+        self.failIf(test.checkIdAvailable('foo'))
+
+
 class PortalFolderMoveTests(SecurityTest):
 
     def setUp(self):



More information about the CMF-checkins mailing list