[CMF-checkins] CVS: Products/CMFCore - PortalFolder.py:1.71.2.4

Yvo Schubbe y.2004_ at wcm-solutions.de
Fri Sep 24 09:29:07 EDT 2004


Update of /cvs-repository/Products/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv28506/CMFCore

Modified Files:
      Tag: CMF-1_5-branch
	PortalFolder.py 
Log Message:
- allowed to overwrite content items of the portal root


=== Products/CMFCore/PortalFolder.py 1.71.2.3 => 1.71.2.4 ===
--- Products/CMFCore/PortalFolder.py:1.71.2.3	Sun Sep 19 09:14:32 2004
+++ Products/CMFCore/PortalFolder.py	Fri Sep 24 09:29:07 2004
@@ -419,9 +419,9 @@
         try:
             self._checkId(id)
         except BadRequest:
-            return 0
+            return False
         else:
-            return 1
+            return True
 
     def MKCOL_handler(self,id,REQUEST=None,RESPONSE=None):
         """
@@ -432,20 +432,25 @@
     def _checkId(self, id, allow_dup=0):
         PortalFolder.inheritedAttribute('_checkId')(self, id, allow_dup)
 
-        # This method prevents people other than the portal manager
-        # from overriding skinned names.
-        if not allow_dup:
-            if not getSecurityManager().checkPermission(ManagePortal, self):
-                ob = self
-                while ob is not None and not getattr(ob, '_isPortalRoot', 0):
-                    ob = aq_parent(aq_inner(ob))
-                if ob is not None:
-                    # If the portal root has an object by this name,
-                    # don't allow an override.
-                    # FIXME: needed to allow index_html for join code
-                    if hasattr(ob, id) and id != 'index_html':
-                        raise BadRequest('The id "%s" is reserved.' % id)
-                    # Otherwise we're ok.
+        if allow_dup:
+            return
+
+        # FIXME: needed to allow index_html for join code
+        if id == 'index_html':
+            return
+
+        # This code prevents people other than the portal manager from
+        # overriding skinned names and tools.
+        if not getSecurityManager().checkPermission(ManagePortal, self):
+            ob = self
+            while ob is not None and not getattr(ob, '_isPortalRoot', False):
+                ob = aq_parent( aq_inner(ob) )
+            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():
+                    raise BadRequest('The id "%s" is reserved.' % id)
+        # Otherwise we're ok.
 
     def _verifyObjectPaste(self, object, validate_src=1):
         # This assists the version in OFS.CopySupport.



More information about the CMF-checkins mailing list