[CMF-checkins] SVN: CMF/branches/2.0/C - IDs starting with '@@' are now reserved for views

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


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

Changed:
  U   CMF/branches/2.0/CHANGES.txt
  U   CMF/branches/2.0/CMFCore/PortalFolder.py
  U   CMF/branches/2.0/CMFCore/tests/test_PortalFolder.py

-=-
Modified: CMF/branches/2.0/CHANGES.txt
===================================================================
--- CMF/branches/2.0/CHANGES.txt	2006-03-24 11:24:59 UTC (rev 66143)
+++ CMF/branches/2.0/CHANGES.txt	2006-03-24 11:25:41 UTC (rev 66144)
@@ -2,6 +2,9 @@
 
   Bug Fixes
 
+    - PortalFolder: Content IDs starting with '@@' are now disallowed.
+      These names are reserved for browser views.
+
     - CMFDefault: Changed the way browser views are hooked up.
       To become independent of the lookup order views are now named different
       than the corresponding skin methods. The views are now enabled by

Modified: CMF/branches/2.0/CMFCore/PortalFolder.py
===================================================================
--- CMF/branches/2.0/CMFCore/PortalFolder.py	2006-03-24 11:24:59 UTC (rev 66143)
+++ CMF/branches/2.0/CMFCore/PortalFolder.py	2006-03-24 11:25:41 UTC (rev 66144)
@@ -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/branches/2.0/CMFCore/tests/test_PortalFolder.py
===================================================================
--- CMF/branches/2.0/CMFCore/tests/test_PortalFolder.py	2006-03-24 11:24:59 UTC (rev 66143)
+++ CMF/branches/2.0/CMFCore/tests/test_PortalFolder.py	2006-03-24 11:25:41 UTC (rev 66144)
@@ -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