[CMF-checkins] SVN: CMF/branches/1.5/C CMFCore.PortalFolder._checkId() allows root doted prefixed name

Julien Anguenot ja at nuxeo.com
Thu Aug 18 12:18:32 EDT 2005


Log message for revision 37988:
  CMFCore.PortalFolder._checkId() allows root doted prefixed name
  object overrides.
  
  

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

-=-
Modified: CMF/branches/1.5/CHANGES.txt
===================================================================
--- CMF/branches/1.5/CHANGES.txt	2005-08-18 11:04:13 UTC (rev 37987)
+++ CMF/branches/1.5/CHANGES.txt	2005-08-18 16:18:32 UTC (rev 37988)
@@ -26,6 +26,11 @@
       content_type. It is now preserved, if possible.
       (http://www.zope.org/Collectors/CMF/370)
 
+  Others
+
+    - CMFCore.PortalFolder._checkId() allows root doted prefixed name
+      object overrides.
+
 CMF 1.5.3 (2005/08/07)
 
   Bugs fixed

Modified: CMF/branches/1.5/CMFCore/PortalFolder.py
===================================================================
--- CMF/branches/1.5/CMFCore/PortalFolder.py	2005-08-18 11:04:13 UTC (rev 37987)
+++ CMF/branches/1.5/CMFCore/PortalFolder.py	2005-08-18 16:18:32 UTC (rev 37988)
@@ -108,9 +108,9 @@
     security = ClassSecurityInfo()
 
     description = ''
-    
+
     manage_options = ( Folder.manage_options +
-                       CMFCatalogAware.manage_options )  
+                       CMFCatalogAware.manage_options )
 
     def __init__( self, id, title='' ):
         self.id = id
@@ -446,7 +446,10 @@
             if ob is not None:
                 # If the portal root has a non-contentish object by this name,
                 # don't allow an override.
-                if hasattr(ob, id) and id not in ob.contentIds():
+                if (hasattr(ob, id) and
+                    id not in ob.contentIds() and
+                    # Allow root doted prefixed object name overrides
+                    not id.startswith('.')):
                     raise BadRequest('The id "%s" is reserved.' % id)
             # Don't allow ids used by Method Aliases.
             ti = self.getTypeInfo()

Modified: CMF/branches/1.5/CMFCore/tests/test_PortalFolder.py
===================================================================
--- CMF/branches/1.5/CMFCore/tests/test_PortalFolder.py	2005-08-18 11:04:13 UTC (rev 37987)
+++ CMF/branches/1.5/CMFCore/tests/test_PortalFolder.py	2005-08-18 16:18:32 UTC (rev 37988)
@@ -418,7 +418,24 @@
         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
+        #
 
+        # Create a .foo at the root
+        self.site._setObject('.foo', DummyContent('.foo'))
+
+        # Create a sub-folder
+        sub = self._makeOne('sub')
+
+        # It should be possible to create another .foo object in the
+        # sub-folder
+        acl_users = self.site._setObject('acl_users', DummyUserFolder())
+        newSecurityManager(None, acl_users.user_foo)
+
+        self.assert_(sub.checkIdAvailable('.foo'))
+
 class PortalFolderMoveTests(SecurityTest):
 
     def setUp(self):



More information about the CMF-checkins mailing list