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

Yvo Schubbe schubbe at web.de
Mon Sep 1 11:44:12 EDT 2003


Update of /cvs-repository/CMF/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv24700/CMFCore

Modified Files:
	PortalFolder.py 
Log Message:
Permissions cleanup:
- Always use imported permissions.
Replaced string functions.

=== CMF/CMFCore/PortalFolder.py 1.47 => 1.48 ===
--- CMF/CMFCore/PortalFolder.py:1.47	Sat Jun 28 12:31:20 2003
+++ CMF/CMFCore/PortalFolder.py	Mon Sep  1 10:44:11 2003
@@ -16,19 +16,21 @@
 """
 
 import sys
-import Globals, re, base64, marshal, string
+import Globals, re, base64, marshal
 
-from CMFCorePermissions import View
-from CMFCorePermissions import ManageProperties
-from CMFCorePermissions import ListFolderContents
-from CMFCorePermissions import AddPortalFolders
-from CMFCorePermissions import AddPortalContent
-from CMFCatalogAware import CMFCatalogAware
 from OFS.Folder import Folder
 from OFS.ObjectManager import REPLACEABLE
 from Globals import DTMLFile
 from AccessControl import getSecurityManager, ClassSecurityInfo, Unauthorized
 from Acquisition import aq_parent, aq_inner, aq_base
+
+from CMFCorePermissions import AddPortalContent
+from CMFCorePermissions import AddPortalFolders
+from CMFCorePermissions import ListFolderContents
+from CMFCorePermissions import ManagePortal
+from CMFCorePermissions import ManageProperties
+from CMFCorePermissions import View
+from CMFCatalogAware import CMFCatalogAware
 from DynamicType import DynamicType
 from utils import getToolByName, _checkPermission
 
@@ -288,8 +290,8 @@
         for key, value in REQUEST.items():
             if key[:10] == 'filter_by_':
                 filter[key[10:]] = value
-        encoded = string.strip(base64.encodestring( marshal.dumps( filter )))
-        encoded = string.join(string.split(encoded, '\n'), '')
+        encoded = base64.encodestring( marshal.dumps(filter) ).strip()
+        encoded = ''.join( encoded.split('\n') )
         return encoded
 
     security.declarePublic('decodeFolderFilter')
@@ -387,7 +389,7 @@
         # This method prevents people other than the portal manager
         # from overriding skinned names.
         if not allow_dup:
-            if not _checkPermission( 'Manage portal', self):
+            if not _checkPermission(ManagePortal, self):
                 ob = self
                 while ob is not None and not getattr(ob, '_isPortalRoot', 0):
                     ob = aq_parent(aq_inner(ob))
@@ -530,8 +532,7 @@
         if Subject and Subject is not self.MARKER: 
             self.filterSubject = Subject
             self.predicates.append( self.hasSubject )
-            self.description.append( 'Subject: %s'
-                                   % string.join( Subject, ', ' ) )
+            self.description.append( 'Subject: %s' % ', '.join(Subject) )
 
         if Description is not self.MARKER: 
             self.predicates.append( lambda x, pat=re.compile( Description ):
@@ -563,16 +564,15 @@
                 Type = [ Type ]
             self.predicates.append( lambda x, Type=Type:
                                       x.Type() in Type )
-            self.description.append( 'Type: %s'
-                                   % string.join( Type, ', ' ) )
+            self.description.append( 'Type: %s' % ', '.join(Type) )
 
         if portal_type and portal_type is not self.MARKER:
             if type(portal_type) is type(''):
                 portal_type = [portal_type]
             self.predicates.append(lambda x, pt=portal_type:
                                    x.getPortalTypeName() in pt)
-            self.description.append('Portal Type: %s'
-                                    % string.join(portal_type, ', '))
+            self.description.append( 'Portal Type: %s'
+                                     % ', '.join(portal_type) )
 
     def hasSubject( self, obj ):
         """
@@ -600,7 +600,7 @@
         """
             Return a stringified description of the filter.
         """
-        return string.join( self.description, '; ' )
+        return '; '.join(self.description)
 
 manage_addPortalFolder = PortalFolder.manage_addPortalFolder
 manage_addPortalFolderForm = DTMLFile( 'folderAdd', globals() )




More information about the CMF-checkins mailing list