[CMF-checkins] CVS: CMF/CMFCore - ActionProviderBase.py:1.22 ActionsTool.py:1.44 CatalogTool.py:1.46 DirectoryView.py:1.39 FSFile.py:1.7 FSImage.py:1.15 FSObject.py:1.16 FSPageTemplate.py:1.21 FSPythonScript.py:1.23 FSSTXMethod.py:1.9 PortalFolder.py:1.50 SkinsContainer.py:1.7 WorkflowCore.py:1.13 utils.py:1.45

Yvo Schubbe cvs-admin at zope.org
Fri Nov 28 09:52:32 EST 2003


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

Modified Files:
	ActionProviderBase.py ActionsTool.py CatalogTool.py 
	DirectoryView.py FSFile.py FSImage.py FSObject.py 
	FSPageTemplate.py FSPythonScript.py FSSTXMethod.py 
	PortalFolder.py SkinsContainer.py WorkflowCore.py utils.py 
Log Message:
some code modernization:
- death to string module
- death to apply
- import and whitespace cleanup


=== CMF/CMFCore/ActionProviderBase.py 1.21 => 1.22 ===
--- CMF/CMFCore/ActionProviderBase.py:1.21	Thu Nov 27 10:06:49 2003
+++ CMF/CMFCore/ActionProviderBase.py	Fri Nov 28 09:52:00 2003
@@ -30,7 +30,6 @@
         import OldstyleActionProvider as IOldstyleActionProvider
 from utils import _checkPermission
 from utils import _dtmldir
-from utils import getToolByName
 
 
 class ActionProviderBase:
@@ -48,7 +47,7 @@
     manage_options = ( { 'label' : 'Actions'
                        , 'action' : 'manage_editActionsForm'
                        }
-                     , 
+                     ,
                      )
 
     #
@@ -302,7 +301,7 @@
         """ Return a list of actions, cloned from our current list.
         """
         return map( lambda x: x.clone(), list( self._actions ) )
- 
+
     security.declarePrivate( '_extractAction' )
     def _extractAction( self, properties, index ):
 


=== CMF/CMFCore/ActionsTool.py 1.43 => 1.44 ===
--- CMF/CMFCore/ActionsTool.py:1.43	Thu Nov 27 10:14:11 2003
+++ CMF/CMFCore/ActionsTool.py	Fri Nov 28 09:52:00 2003
@@ -17,9 +17,10 @@
 
 from types import DictionaryType
 
-from Globals import InitializeClass, DTMLFile, package_home
 from AccessControl import ClassSecurityInfo
-from Acquisition import aq_base, aq_inner, aq_parent
+from Acquisition import aq_base
+from Globals import DTMLFile
+from Globals import InitializeClass
 from OFS.Folder import Folder
 from OFS.SimpleItem import SimpleItem
 
@@ -34,7 +35,6 @@
 from TypesTool import TypeInformation
 from utils import _checkPermission
 from utils import _dtmldir
-from utils import getToolByName
 from utils import SimpleItemWithProperties
 from utils import UniqueObject
 


=== CMF/CMFCore/CatalogTool.py 1.45 => 1.46 ===
--- CMF/CMFCore/CatalogTool.py:1.45	Thu Sep 25 06:29:59 2003
+++ CMF/CMFCore/CatalogTool.py	Fri Nov 28 09:52:00 2003
@@ -16,10 +16,11 @@
 """
 
 from Products.ZCatalog.ZCatalog import ZCatalog
-from Globals import InitializeClass, package_home, DTMLFile
 from DateTime import DateTime
 from AccessControl.PermissionRole import rolesForPermissionOn
 from AccessControl import ClassSecurityInfo
+from Globals import DTMLFile
+from Globals import InitializeClass
 
 from utils import _checkPermission
 from utils import _dtmldir
@@ -27,12 +28,9 @@
 from utils import _mergedLocalRoles
 from utils import UniqueObject
 from ActionProviderBase import ActionProviderBase
-from ActionInformation import ActionInformation
-from Expression import Expression
 from CMFCorePermissions import AccessInactivePortalContent
 from CMFCorePermissions import ManagePortal
 from CMFCorePermissions import View
-from Acquisition import aq_base
 
 from interfaces.portal_catalog \
         import IndexableObjectWrapper as IIndexableObjectWrapper
@@ -86,18 +84,18 @@
     manage_options = ( ZCatalog.manage_options +
                       ActionProviderBase.manage_options +
                       ({ 'label' : 'Overview', 'action' : 'manage_overview' }
-                     , 
+                     ,
                      ))
 
     def __init__(self):
         ZCatalog.__init__(self, self.getId())
-        
+
         if not hasattr(self, 'Vocabulary'):
             # As of 2.6, the Catalog no longer adds a vocabulary in itself
             from Products.PluginIndexes.TextIndex.Vocabulary import Vocabulary
             vocabulary = Vocabulary('Vocabulary', 'Vocabulary', globbing=1)
             self._setObject('Vocabulary', vocabulary)
-            
+
         self._initIndexes()
 
     #
@@ -128,7 +126,7 @@
                , ('path', 'PathIndex')
                , ('portal_type', 'FieldIndex')
                )
-    
+
     security.declarePublic( 'enumerateColumns' )
     def enumerateColumns( self ):
         #   Return a sequence of schema names to be cached.


=== CMF/CMFCore/DirectoryView.py 1.38 => 1.39 ===
--- CMF/CMFCore/DirectoryView.py:1.38	Mon Mar 24 00:03:08 2003
+++ CMF/CMFCore/DirectoryView.py	Fri Nov 28 09:52:00 2003
@@ -1,41 +1,44 @@
 ##############################################################################
 #
 # Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-# 
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE
-# 
+#
 ##############################################################################
 """ Views of filesystem directories as folders.
 
 $Id$
 """
 
-import Globals
-from Globals import HTMLFile, Persistent, package_home, DTMLFile
-import os
+import re
 from os import path, listdir, stat
-from Acquisition import aq_inner, aq_parent, aq_base
-from string import split, rfind, strip, join
-from App.Common import package_home
-from OFS.ObjectManager import bad_id
-from OFS.Folder import Folder
+from sys import exc_info
+from types import StringType
+
 from AccessControl import ClassSecurityInfo
+from Acquisition import aq_inner, aq_parent
+from Globals import DevelopmentMode
+from Globals import DTMLFile
+from Globals import HTMLFile
+from Globals import InitializeClass
+from Globals import package_home
+from Globals import Persistent
+from OFS.Folder import Folder
+from OFS.ObjectManager import bad_id
+from zLOG import LOG, ERROR
+
 from CMFCorePermissions import AccessContentsInformation
 from CMFCorePermissions import ManagePortal
-from FSObject import BadFile
-from utils import expandpath, minimalpath
-from zLOG import LOG, ERROR
-from sys import exc_info
-from types import StringType
 from FSMetadata import FSMetadata
-import re
-
-_dtmldir = path.join( package_home( globals() ), 'dtml' )
+from FSObject import BadFile
+from utils import _dtmldir
+from utils import expandpath
+from utils import minimalpath
 
 __reload_module__ = 0
 
@@ -58,6 +61,7 @@
               if name not in ignore and not ignore_re.match(name) ]
     listdir.extend(names)
 
+
 class DirectoryInformation:
     data = None
     _v_last_read = 0
@@ -97,13 +101,15 @@
             lines = f.readlines()
             f.close()
             for line in lines:
-                try: obname, meta_type = split(line, ':')
-                except: pass
+                try:
+                    obname, meta_type = line.split(':')
+                except ValueError:
+                    pass
                 else:
-                    types[strip(obname)] = strip(meta_type)
+                    types[obname.strip()] = meta_type.strip()
         return types
 
-    if Globals.DevelopmentMode:
+    if DevelopmentMode:
 
         def _changed(self):
             mtime=0
@@ -111,13 +117,13 @@
             try:
                 fp = expandpath(self.filepath)
                 mtime = stat(fp)[8]
-                # some Windows directories don't change mtime 
+                # some Windows directories don't change mtime
                 # when a file is added to or deleted from them :-(
                 # So keep a list of files as well, and see if that
                 # changes
                 path.walk(fp,_walker,filelist)
                 filelist.sort()
-            except: 
+            except:
                 LOG('DirectoryView',
                     ERROR,
                     'Error checking for directory modification',
@@ -126,16 +132,16 @@
             if mtime != self._v_last_read or filelist != self._v_last_filelist:
                 self._v_last_read = mtime
                 self._v_last_filelist = filelist
-                
+
                 return 1
 
             return 0
-        
+
     else:
 
         def _changed(self):
             return 0
-        
+
     def getContents(self, registry):
         changed = self._changed()
         if self.data is None or changed:
@@ -149,7 +155,7 @@
                     error=exc_info())
                 self.data = {}
                 self.objects = ()
-                    
+
         return self.data, self.objects
 
     def prepareContents(self, registry, register_subdirs=0):
@@ -183,7 +189,7 @@
                     data[ob_id] = ob
                     objects.append({'id': ob_id, 'meta_type': ob.meta_type})
             else:
-                pos = rfind(entry, '.')
+                pos = entry.rfind('.')
                 if pos >= 0:
                     name = entry[:pos]
                     ext = path.normcase(entry[pos + 1:])
@@ -205,7 +211,7 @@
                     t = registry.getTypeByMetaType(mt)
                 if t is None:
                     t = registry.getTypeByExtension(ext)
-                
+
                 if t is not None:
                     metadata = FSMetadata(e_fp)
                     metadata.read()
@@ -219,17 +225,16 @@
                             exc_lines = traceback.format_exception( typ,
                                                                     val,
                                                                     tb )
-                            LOG( 'DirectoryView',
-                                 ERROR,
-                                 join( exc_lines, '\n' ) )
-                            
+                            LOG( 'DirectoryView', ERROR,
+                                 '\n'.join(exc_lines) )
+
                             ob = BadFile( name,
                                           e_filepath,
-                                          exc_str=join( exc_lines, '\r\n' ),
+                                          exc_str='\r\n'.join(exc_lines),
                                           fullname=entry )
                         finally:
                             tb = None   # Avoid leaking frame!
-                            
+
                     # FS-based security
                     try:
                         permissions = metadata.getSecurity()
@@ -252,11 +257,11 @@
                                 ERROR,
                                 'Error setting proxy role',
                                 error=exc_info())
-                    
+
                     ob_id = ob.getId()
                     data[ob_id] = ob
                     objects.append({'id': ob_id, 'meta_type': ob.meta_type})
-                    
+
         return data, tuple(objects)
 
 
@@ -266,7 +271,7 @@
         self._meta_types = {}
         self._object_types = {}
         self._directories = {}
-    
+
     def registerFileExtension(self, ext, klass):
         self._object_types[ext] = klass
 
@@ -319,7 +324,7 @@
         dirs = self._directories.keys()
         dirs.sort()
         return dirs
-        
+
 
 _dirreg = DirectoryRegistry()
 registerDirectory = _dirreg.registerDirectory
@@ -388,7 +393,7 @@
     def getId(self):
         return self.id
 
-Globals.InitializeClass(DirectoryView)
+InitializeClass(DirectoryView)
 
 
 class DirectoryViewSurrogate (Folder):
@@ -452,8 +457,8 @@
     security.declarePublic('getId')
     def getId(self):
         return self.id
-    
-Globals.InitializeClass(DirectoryViewSurrogate)
+
+InitializeClass(DirectoryViewSurrogate)
 
 
 manage_addDirectoryViewForm = HTMLFile('dtml/addFSDirView', globals())
@@ -504,4 +509,3 @@
     '''
     '''
     return list(_dirreg.listDirectories())
-


=== CMF/CMFCore/FSFile.py 1.6 => 1.7 ===
--- CMF/CMFCore/FSFile.py:1.6	Thu Feb 20 10:16:51 2003
+++ CMF/CMFCore/FSFile.py	Fri Nov 28 09:52:00 2003
@@ -1,33 +1,37 @@
 ##############################################################################
 #
 # Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-# 
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE
-# 
+#
 ##############################################################################
-"""Customizable image objects that come from the filesystem."""
-__version__='$Revision$'[11:-2]
+""" Customizable image objects that come from the filesystem.
 
-import string, os
+$Id$
+"""
 
 import Globals
 from DateTime import DateTime
 from AccessControl import ClassSecurityInfo
 from webdav.common import rfc1123_date
+from OFS.Cache import Cacheable
 from OFS.Image import File
 from OFS.content_types import guess_content_type
 
-from utils import _dtmldir
-from CMFCorePermissions import ViewManagementScreens, View, FTPAccess
+from CMFCorePermissions import FTPAccess
+from CMFCorePermissions import View
+from CMFCorePermissions import ViewManagementScreens
+from DirectoryView import registerFileExtension
+from DirectoryView import registerMetaType
 from FSObject import FSObject
-from DirectoryView import registerFileExtension, registerMetaType, expandpath
+from utils import _dtmldir
+from utils import expandpath
 
-from OFS.Cache import Cacheable
 
 class FSFile(FSObject):
     """FSFiles act like images but are not directly
@@ -75,7 +79,7 @@
         return data
 
     #### The following is mainly taken from OFS/File.py ###
-        
+
     __str__ = File.__str__
 
     security.declareProtected(View, 'index_html')
@@ -91,7 +95,7 @@
         # HTTP If-Modified-Since header handling.
         header=REQUEST.get_header('If-Modified-Since', None)
         if header is not None:
-            header=string.split(header, ';')[0]
+            header = header.split(';')[0]
             # Some proxies seem to send invalid date strings for this
             # header. If the date string is not valid, we ignore it
             # rather than raise an error to be generally consistent


=== CMF/CMFCore/FSImage.py 1.14 => 1.15 ===
--- CMF/CMFCore/FSImage.py:1.14	Thu Nov 14 11:49:10 2002
+++ CMF/CMFCore/FSImage.py	Fri Nov 28 09:52:00 2003
@@ -1,34 +1,37 @@
 ##############################################################################
 #
 # Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-# 
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE
-# 
+#
 ##############################################################################
 """ Customizable image objects that come from the filesystem.
 
 $Id$
 """
 
-import string, os
-
 import Globals
 from DateTime import DateTime
 from AccessControl import ClassSecurityInfo
 from webdav.common import rfc1123_date
+from OFS.Cache import Cacheable
 from OFS.Image import Image, getImageInfo
 
-from utils import _dtmldir, _setCacheHeaders
-from CMFCorePermissions import ViewManagementScreens, View, FTPAccess
+from CMFCorePermissions import FTPAccess
+from CMFCorePermissions import View
+from CMFCorePermissions import ViewManagementScreens
+from DirectoryView import registerFileExtension
+from DirectoryView import registerMetaType
 from FSObject import FSObject
-from DirectoryView import registerFileExtension, registerMetaType, expandpath
+from utils import _dtmldir
+from utils import _setCacheHeaders
+from utils import expandpath
 
-from OFS.Cache import Cacheable
 
 class FSImage(FSObject):
     """FSImages act like images but are not directly
@@ -73,7 +76,7 @@
         return data
 
     #### The following is mainly taken from OFS/Image.py ###
-        
+
     __str__ = Image.__str__
 
     _image_tag = Image.tag
@@ -81,7 +84,7 @@
     def tag(self, *args, **kw):
         # Hook into an opportunity to reload metadata.
         self._updateFromFS()
-        return apply(self._image_tag, args, kw)
+        return self._image_tag(*args, **kw)
 
     security.declareProtected(View, 'index_html')
     def index_html(self, REQUEST, RESPONSE):
@@ -96,7 +99,7 @@
         # HTTP If-Modified-Since header handling.
         header=REQUEST.get_header('If-Modified-Since', None)
         if header is not None:
-            header=string.split(header, ';')[0]
+            header = header.split(';')[0]
             # Some proxies seem to send invalid date strings for this
             # header. If the date string is not valid, we ignore it
             # rather than raise an error to be generally consistent


=== CMF/CMFCore/FSObject.py 1.15 => 1.16 ===
--- CMF/CMFCore/FSObject.py:1.15	Fri Sep 12 20:46:40 2003
+++ CMF/CMFCore/FSObject.py	Fri Nov 28 09:52:00 2003
@@ -1,39 +1,40 @@
 ##############################################################################
 #
 # Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-# 
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE
-# 
+#
 ##############################################################################
 """ Customizable objects that come from the filesystem (base class).
 
 $Id$
 """
 
-from string import split
 from os import path, stat
 
-import Acquisition, Globals
+import Globals
 from AccessControl import ClassSecurityInfo
+from Acquisition import Implicit
+from OFS.Cache import Cacheable
 from OFS.SimpleItem import Item
 from DateTime import DateTime
 from Products.PythonScripts.standard import html_quote
 
-from utils import expandpath, getToolByName
+from CMFCorePermissions import ManagePortal
 from CMFCorePermissions import View
 from CMFCorePermissions import ViewManagementScreens
-from CMFCorePermissions import ManagePortal
+from utils import expandpath
+from utils import getToolByName
 
-from OFS.Cache import Cacheable
 
-class FSObject(Acquisition.Implicit, Item, Cacheable):
+class FSObject(Implicit, Item, Cacheable):
     """FSObject is a base class for all filesystem based look-alikes.
-    
+
     Subclasses of this class mimic ZODB based objects like Image and
     DTMLMethod, but are not directly modifiable from the management
     interface. They provide means to create a TTW editable copy, however.
@@ -64,7 +65,7 @@
         self.__name__ = id # __name__ is used in traceback reporting
         self._filepath = filepath
         fp = expandpath(self._filepath)
-        
+
         try: self._file_mod_time = stat(fp)[8]
         except: pass
         self._readFile(0)
@@ -77,10 +78,10 @@
         """
 
         obj = self._createZODBClone()
-        
+
         id = obj.getId()
-        fpath = tuple(split(folder_path, '/'))
-        portal_skins = getToolByName(self,'portal_skins') 
+        fpath = tuple( folder_path.split('/') )
+        portal_skins = getToolByName(self,'portal_skins')
         folder = portal_skins.restrictedTraverse(fpath)
         if id in folder.objectIds():
             # we cant catch the badrequest so
@@ -90,9 +91,9 @@
                 RESPONSE.redirect('%s/manage_main?manage_tabs_message=%s' % (
                     obj.absolute_url(), html_quote("An object with this id already exists")
                     ))
-        else:            
+        else:
             folder._verifyObjectPaste(obj, validate_src=0)
-            folder._setObject(id, obj)        
+            folder._setObject(id, obj)
 
             if RESPONSE is not None:
                 RESPONSE.redirect('%s/%s/manage_main' % (
@@ -108,7 +109,7 @@
 
     def _readFile(self, reparse):
         """Read the data from the filesystem.
-        
+
         Read the file indicated by exandpath(self._filepath), and parse the
         data if necessary.  'reparse' is set when reading the second
         time and beyond.
@@ -153,6 +154,7 @@
 
 Globals.InitializeClass(FSObject)
 
+
 class BadFile( FSObject ):
     """
         Represent a file which was not readable or parseable
@@ -201,7 +203,7 @@
     security.declarePrivate( '_readFile' )
     def _readFile( self, reparse ):
         """Read the data from the filesystem.
-        
+
         Read the file indicated by exandpath(self._filepath), and parse the
         data if necessary.  'reparse' is set when reading the second
         time and beyond.
@@ -216,14 +218,14 @@
         except:  # No errors of any sort may propagate
             data = self.file_contents = None #give up
         return data
-    
+
     security.declarePublic( 'getFileContents' )
     def getFileContents( self ):
         """
             Return the contents of the file, if we could read it.
         """
         return self.file_contents
-    
+
     security.declarePublic( 'getExceptionText' )
     def getExceptionText( self ):
         """
@@ -231,6 +233,5 @@
             the file.
         """
         return self.exc_str
-
 
 Globals.InitializeClass( BadFile )


=== CMF/CMFCore/FSPageTemplate.py 1.20 => 1.21 ===
--- CMF/CMFCore/FSPageTemplate.py:1.20	Mon Sep  1 11:59:41 2003
+++ CMF/CMFCore/FSPageTemplate.py	Fri Nov 28 09:52:00 2003
@@ -1,49 +1,46 @@
 ##############################################################################
 #
 # Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-# 
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE
-# 
-##########################################################################
-"""Customizable page templates that come from the filesystem.
+#
+##############################################################################
+""" Customizable page templates that come from the filesystem.
 
 $Id$
 """
 
-from string import split, replace
-from os import stat
 import re, sys
 
-import Globals, Acquisition
-from DateTime import DateTime
+import Globals
 from DocumentTemplate.DT_Util import html_quote
-from Acquisition import aq_parent
 from AccessControl import getSecurityManager, ClassSecurityInfo
+from OFS.Cache import Cacheable
 from Shared.DC.Scripts.Script import Script
 from Products.PageTemplates.PageTemplate import PageTemplate
 from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate, Src
 
-from DirectoryView import registerFileExtension, registerMetaType, expandpath
-from CMFCorePermissions import ViewManagementScreens
-from CMFCorePermissions import View
 from CMFCorePermissions import FTPAccess
+from CMFCorePermissions import View
+from CMFCorePermissions import ViewManagementScreens
+from DirectoryView import registerFileExtension
+from DirectoryView import registerMetaType
 from FSObject import FSObject
-from utils import getToolByName, _setCacheHeaders
+from utils import _setCacheHeaders
+from utils import expandpath
 
 xml_detect_re = re.compile('^\s*<\?xml\s+')
-
-from OFS.Cache import Cacheable
-
 _marker = []  # Create a new marker object.
 
+
 class FSPageTemplate(FSObject, Script, PageTemplate):
     "Wrapper for Page Template"
-     
+
     meta_type = 'Filesystem Page Template'
 
     _owner = None  # Unowned
@@ -54,7 +51,7 @@
             {'label':'Test', 'action':'ZScriptHTML_tryForm'},
             )
             +Cacheable.manage_options
-        ) 
+        )
 
     security = ClassSecurityInfo()
     security.declareObjectProtected(View)
@@ -82,9 +79,9 @@
     def _readFile(self, reparse):
         fp = expandpath(self._filepath)
         file = open(fp, 'r')    # not 'rb', as this is a text file!
-        try: 
+        try:
             data = file.read()
-        finally: 
+        finally:
             file.close()
         if reparse:
             if xml_detect_re.match(data):
@@ -134,13 +131,13 @@
                 if not err:
                     err = sys.exc_info()
                 err_type = err[0]
-                err_msg = '<pre>%s</pre>' % replace( str(err[1]), "\'", "'" )
+                err_msg = '<pre>%s</pre>' % str(err[1]).replace("\'", "'")
                 msg = 'FS Page Template %s has errors: %s.<br>%s' % (
                     self.id, err_type, html_quote(err_msg) )
                 raise RuntimeError, msg
             else:
                 raise
-                
+
     security.declarePrivate( '_ZPT_exec' )
     _ZPT_exec = ZopePageTemplate._exec
 
@@ -153,7 +150,7 @@
             response = None
         # Read file first to get a correct content_type default value.
         self._updateFromFS()
-        
+
         if not kw.has_key('args'):
             kw['args'] = args
         bound_names['options'] = kw
@@ -164,7 +161,7 @@
                 response.setHeader('content-type', self.content_type)
         except AttributeError:
             pass
-            
+
         security=getSecurityManager()
         bound_names['user'] = security.getUser()
 
@@ -175,7 +172,7 @@
             keyset = {
                       # Why oh why?
                       # All this code is cut and paste
-                      # here to make sure that we 
+                      # here to make sure that we
                       # dont call _getContext and hence can't cache
                       # Annoying huh?
                       'here': self.aq_parent.getPhysicalPath(),
@@ -195,9 +192,9 @@
             return result
         finally:
             security.removeContext(self)
-        
+
         return result
- 
+
     # Copy over more methods
     security.declareProtected(FTPAccess, 'manage_FTPget')
     manage_FTPget = ZopePageTemplate.manage_FTPget
@@ -227,4 +224,3 @@
 registerFileExtension('html', FSPageTemplate)
 registerFileExtension('htm', FSPageTemplate)
 registerMetaType('Page Template', FSPageTemplate)
-


=== CMF/CMFCore/FSPythonScript.py 1.22 => 1.23 ===
--- CMF/CMFCore/FSPythonScript.py:1.22	Mon Aug  4 16:05:43 2003
+++ CMF/CMFCore/FSPythonScript.py	Fri Nov 28 09:52:00 2003
@@ -1,39 +1,42 @@
 ##############################################################################
 #
 # Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-# 
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE
-# 
+#
 ##############################################################################
 """ Customizable Python scripts that come from the filesystem.
 
 $Id$
 """
 
-from string import strip, split
 from os import path, stat
 import new
 
 import Globals
 from AccessControl import ClassSecurityInfo, getSecurityManager
+from OFS.Cache import Cacheable
 from Products.PythonScripts.PythonScript import PythonScript
 from Shared.DC.Scripts.Script import Script
 from ComputedAttribute import ComputedAttribute
 
-from utils import _dtmldir
-from CMFCorePermissions import ViewManagementScreens, View, FTPAccess
-from DirectoryView import registerFileExtension, registerMetaType, expandpath
+from CMFCorePermissions import FTPAccess
+from CMFCorePermissions import View
+from CMFCorePermissions import ViewManagementScreens
+from DirectoryView import registerFileExtension
+from DirectoryView import registerMetaType
 from FSObject import FSObject
-
-from OFS.Cache import Cacheable
+from utils import _dtmldir
+from utils import expandpath
 
 _marker = []
 
+
 class bad_func_code:
     co_varnames = ()
     co_argcount = 0
@@ -49,7 +52,7 @@
     _proxy_roles = ()
 
     _owner = None  # Unowned
-    
+
     manage_options=(
         (
             {'label':'Customize', 'action':'manage_main'},
@@ -79,7 +82,7 @@
 
     def _readFile(self, reparse):
         """Read the data from the filesystem.
-        
+
         Read the file (indicated by exandpath(self._filepath), and parse the
         data if necessary.
         """
@@ -129,7 +132,6 @@
                 # Got a cached value.
                 return result
 
-        
         # Prepare the function.
         f = self._v_f
         if f is None:
@@ -157,10 +159,10 @@
         security=getSecurityManager()
         security.addContext(self)
         try:
-            result = apply(f, args, kw)
+            result = f(*args, **kw)
             if keyset is not None:
                 # Store the result in the cache.
-                self.ZCacheable_set(result, keywords=keyset)           
+                self.ZCacheable_set(result, keywords=keyset)
             return result
         finally:
             security.removeContext(self)
@@ -174,10 +176,10 @@
     def ZScriptHTML_tryParams(self):
         """Parameters to test the script with."""
         param_names = []
-        for name in split(self._params, ','):
-            name = strip(name)
+        for name in self._params.split(','):
+            name = name.strip()
             if name and name[0] != '*':
-                param_names.append(split(name, '=', 1)[0])
+                param_names.append( name.split('=', 1)[0] )
         return param_names
 
     security.declareProtected(ViewManagementScreens, 'read')
@@ -270,7 +272,6 @@
             # Now do it for real
             self._updateFromFS()
         return self._bind_names
-
 
 Globals.InitializeClass(FSPythonScript)
 


=== CMF/CMFCore/FSSTXMethod.py 1.8 => 1.9 ===
--- CMF/CMFCore/FSSTXMethod.py:1.8	Thu Jan 30 15:26:50 2003
+++ CMF/CMFCore/FSSTXMethod.py	Fri Nov 28 09:52:00 2003
@@ -1,34 +1,31 @@
 ##############################################################################
 #
 # Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-# 
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE
-# 
+#
 ##############################################################################
-"""FSSTXMethod: Filesystem methodish Structured Text document.
+""" FSSTXMethod: Filesystem methodish Structured Text document.
 
 $Id$
 """
 
 import Globals
 from AccessControl import ClassSecurityInfo
-import StructuredText
 
+from CMFCorePermissions import FTPAccess
+from CMFCorePermissions import View
+from CMFCorePermissions import ViewManagementScreens
 from DirectoryView import registerFileExtension
 from DirectoryView import registerMetaType
-from DirectoryView import expandpath
 from FSObject import FSObject
-
-from CMFCorePermissions import View
-from CMFCorePermissions import ViewManagementScreens
-from CMFCorePermissions import FTPAccess
-
 from utils import _dtmldir
+from utils import expandpath
 from utils import format_stx
 
 
@@ -91,7 +88,7 @@
     func_code.co_varnames= ()
     func_code.co_argcount=0
     func_code.__roles__=()
-    
+
     func_defaults__roles__=()
     func_defaults=()
 
@@ -119,7 +116,7 @@
 
         if RESPONSE is not None:
             RESPONSE.setHeader( 'Content-Type', 'text/html' )
-        return apply( self._render, ( REQUEST, RESPONSE ), kw )
+        return self._render(REQUEST, RESPONSE, **kw)
 
     security.declarePrivate( '_render' )
     def _render( self, REQUEST={}, RESPONSE=None, **kw ):
@@ -133,8 +130,8 @@
             posargs = ( self, REQUEST )
         else:
             posargs = ()
-        
-        return apply( template, posargs, { 'cooked' : self.cook() } )
+
+        return template(*posargs, **{ 'cooked' : self.cook() } )
 
     security.declareProtected( FTPAccess, 'manage_FTPget' )
     def manage_FTPget( self ):


=== CMF/CMFCore/PortalFolder.py 1.49 => 1.50 ===
--- CMF/CMFCore/PortalFolder.py:1.49	Wed Sep 24 06:02:14 2003
+++ CMF/CMFCore/PortalFolder.py	Fri Nov 28 09:52:00 2003
@@ -16,14 +16,16 @@
 """
 
 import sys
-import Globals, re, base64, marshal
+import re, base64, marshal
 
+from Globals import DTMLFile
+from Globals import InitializeClass
 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 CMFCatalogAware import CMFCatalogAware
 from CMFCorePermissions import AddPortalContent
 from CMFCorePermissions import AddPortalFolders
 from CMFCorePermissions import ChangeLocalRoles
@@ -31,7 +33,6 @@
 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
 
@@ -133,7 +134,7 @@
         return filter( lambda typ, container=self:
                           typ.isConstructionAllowed( container )
                      , result )
-    
+
     security.declareProtected(AddPortalFolders, 'manage_addPortalFolder')
     def manage_addPortalFolder(self, id, title='', REQUEST=None):
         """Add a new PortalFolder object with id *id*.
@@ -143,7 +144,7 @@
         if REQUEST is not None:
             return self.folder_contents( # XXX: ick!
                 self, REQUEST, portal_status_message="Folder added")
-    
+
     def _morphSpec(self, spec):
         '''
         spec is a sequence of meta_types, a string containing one meta type,
@@ -163,7 +164,7 @@
                                        % meta_type )
                 new_spec.append(meta_type)
         return new_spec or types
-    
+
     def _filteredItems( self, ids, filt ):
         """
             Apply filter, a mapping, to child objects indicated by 'ids',
@@ -190,7 +191,7 @@
             return []
         filt['portal_type'] = pt
 
-        query = apply( ContentFilter, (), filt )
+        query = ContentFilter(**filt)
         result = []
         append = result.append
         get = self._getOb
@@ -336,7 +337,7 @@
         typeObjectName = registry.findTypeName( name, typ, body )
         if typeObjectName is None:
             return None
-        
+
         self.invokeFactory( typeObjectName, name )
 
         # XXX: this is butt-ugly.
@@ -345,27 +346,17 @@
         return obj
 
     security.declareProtected(AddPortalContent, 'invokeFactory')
-    def invokeFactory( self
-                     , type_name
-                     , id
-                     , RESPONSE=None
-                     , *args
-                     , **kw
-                     ):
-        '''
-        Invokes the portal_types tool.
-        '''
-        pt = getToolByName( self, 'portal_types' )
+    def invokeFactory(self, type_name, id, RESPONSE=None, *args, **kw):
+        """ Invokes the portal_types tool.
+        """
+        pt = getToolByName(self, 'portal_types')
         myType = pt.getTypeInfo(self)
 
         if myType is not None:
             if not myType.allowType( type_name ):
                 raise ValueError, 'Disallowed subobject type: %s' % type_name
 
-        apply( pt.constructContent
-             , (type_name, self, id, RESPONSE) + args
-             , kw
-             )
+        pt.constructContent(type_name, self, id, RESPONSE, *args, **kw)
 
     security.declareProtected(AddPortalContent, 'checkIdAvailable')
     def checkIdAvailable(self, id):
@@ -386,7 +377,7 @@
 
     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:
@@ -435,7 +426,7 @@
                 else:
                     raise 'Unauthorized', permission_name
             #
-            # Old validation for objects that may not have registered 
+            # Old validation for objects that may not have registered
             # themselves in the proper fashion.
             #
             elif method_name is not None:
@@ -493,8 +484,7 @@
         if REQUEST is not None:
             return self.manage_main(self, REQUEST, update_menu=1)
 
-Globals.InitializeClass(PortalFolder)
-    
+InitializeClass(PortalFolder)
 
 
 class ContentFilter:
@@ -520,27 +510,27 @@
         self.predicates = []
         self.description = []
 
-        if Title is not self.MARKER: 
+        if Title is not self.MARKER:
             self.predicates.append( lambda x, pat=re.compile( Title ):
                                       pat.search( x.Title() ) )
             self.description.append( 'Title: %s' % Title )
 
-        if Creator is not self.MARKER: 
+        if Creator is not self.MARKER:
             self.predicates.append( lambda x, pat=re.compile( Creator ):
                                       pat.search( x.Creator() ) )
             self.description.append( 'Creator: %s' % Creator )
 
-        if Subject and Subject is not self.MARKER: 
+        if Subject and Subject is not self.MARKER:
             self.filterSubject = Subject
             self.predicates.append( self.hasSubject )
             self.description.append( 'Subject: %s' % ', '.join(Subject) )
 
-        if Description is not self.MARKER: 
+        if Description is not self.MARKER:
             self.predicates.append( lambda x, pat=re.compile( Description ):
                                       pat.search( x.Description() ) )
             self.description.append( 'Description: %s' % Description )
 
-        if created is not self.MARKER: 
+        if created is not self.MARKER:
             if created_usage == 'range:min':
                 self.predicates.append( lambda x, cd=created:
                                           cd <= x.created() )
@@ -550,7 +540,7 @@
                                           cd >= x.created() )
                 self.description.append( 'Created before: %s' % created )
 
-        if modified is not self.MARKER: 
+        if modified is not self.MARKER:
             if modified_usage == 'range:min':
                 self.predicates.append( lambda x, md=modified:
                                           md <= x.modified() )


=== CMF/CMFCore/SkinsContainer.py 1.6 => 1.7 ===
--- CMF/CMFCore/SkinsContainer.py:1.6	Thu Aug 22 13:45:53 2002
+++ CMF/CMFCore/SkinsContainer.py	Fri Nov 28 09:52:00 2003
@@ -1,25 +1,25 @@
 ##############################################################################
 #
 # Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-# 
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE
-# 
+#
 ##############################################################################
 """ Base class for objects that supply skins.
 
 $Id$
 """
 
-from string import split, join, strip
 from Acquisition import aq_base
 from AccessControl import ClassSecurityInfo
 from Globals import InitializeClass
 
+
 class SkinPathError (Exception):
     'Invalid skin path'
     pass
@@ -57,11 +57,11 @@
         '''
         baseself = aq_base(self)
         skinob = baseself
-        parts = list(split(path, ','))
+        parts = list( path.split(',') )
         parts.reverse()
         for part_path in parts:
             partob = baseself
-            for name in split(strip(part_path), '/'):
+            for name in part_path.strip().split('/'):
                 if name == '':
                     continue
                 if name[:1] == '_':
@@ -84,7 +84,7 @@
                 # of the new skinob.
                 skinob = partob.__of__(skinob)
         return skinob
-        
+
     security.declarePrivate('getSkinByName')
     def getSkinByName(self, name):
         path = self.getSkinPath(name)


=== CMF/CMFCore/WorkflowCore.py 1.12 => 1.13 ===
--- CMF/CMFCore/WorkflowCore.py:1.12	Thu Jul 25 11:06:39 2002
+++ CMF/CMFCore/WorkflowCore.py	Fri Nov 28 09:52:00 2003
@@ -1,16 +1,15 @@
 ##############################################################################
 #
 # Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-# 
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE
-# 
+#
 ##############################################################################
-
 """ Common pieces of the workflow architecture.
 
 $Id$
@@ -18,8 +17,8 @@
 import sys
 
 from Acquisition import aq_base
-
 from MethodObject import Method
+
 from utils import getToolByName
 
 
@@ -80,7 +79,7 @@
         if wf is None or not hasattr(wf, 'wrapWorkflowMethod'):
             # No workflow tool found.
             try:
-                res = apply(self._m, (instance,) + args, kw)
+                res = self._m(instance, *args, **kw)
             except ObjectDeleted, ex:
                 res = ex.getResult()
             else:


=== CMF/CMFCore/utils.py 1.44 => 1.45 ===
--- CMF/CMFCore/utils.py:1.44	Wed Nov 19 04:48:37 2003
+++ CMF/CMFCore/utils.py	Fri Nov 28 09:52:00 2003
@@ -343,11 +343,12 @@
     security.declarePrivate('manage_changePropertyTypes')
 
     def manage_propertiesForm(self, REQUEST, *args, **kw):
-        'An override that makes the schema fixed.'
+        """ An override that makes the schema fixed.
+        """
         my_kw = kw.copy()
         my_kw['property_extensible_schema__'] = 0
-        return apply(PropertyManager.manage_propertiesForm,
-                     (self, self, REQUEST,) + args, my_kw)
+        return PropertyManager.manage_propertiesForm(self, self, REQUEST,
+                                                     *args, **my_kw)
 
     security.declarePublic('propertyLabel')
     def propertyLabel(self, id):




More information about the CMF-checkins mailing list