[CMF-checkins] CVS: Products/CMFCore - CatalogTool.py:1.61 FSDTMLMethod.py:1.26 FSFile.py:1.14 FSMetadata.py:1.10 MembershipTool.py:1.52 SkinsTool.py:1.33 WorkflowTool.py:1.51 utils.py:1.67

Yvo Schubbe y.2005- at wcm-solutions.de
Thu Apr 7 12:39:17 EDT 2005


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

Modified Files:
	CatalogTool.py FSDTMLMethod.py FSFile.py FSMetadata.py 
	MembershipTool.py SkinsTool.py WorkflowTool.py utils.py 
Log Message:
- get rid of 'not not' and types module
- import and whitespace cleanup


=== Products/CMFCore/CatalogTool.py 1.60 => 1.61 ===
--- Products/CMFCore/CatalogTool.py:1.60	Fri Mar 25 12:17:26 2005
+++ Products/CMFCore/CatalogTool.py	Thu Apr  7 12:38:46 2005
@@ -15,34 +15,32 @@
 $Id$
 """
 
-from types import TupleType, ListType
 from AccessControl import ClassSecurityInfo
 from AccessControl.PermissionRole import rolesForPermissionOn
 from DateTime import DateTime
 from Globals import DTMLFile
 from Globals import InitializeClass
 from Products.ZCatalog.ZCatalog import ZCatalog
-from Products.ZCTextIndex.Lexicon import Splitter
+from Products.ZCTextIndex.HTMLSplitter import HTMLWordSplitter
 from Products.ZCTextIndex.Lexicon import CaseNormalizer
+from Products.ZCTextIndex.Lexicon import Splitter
 from Products.ZCTextIndex.Lexicon import StopWordRemover
-from Products.ZCTextIndex.HTMLSplitter import HTMLWordSplitter
 from Products.ZCTextIndex.ZCTextIndex import PLexicon
 
+from ActionProviderBase import ActionProviderBase
+from interfaces.portal_catalog \
+        import IndexableObjectWrapper as IIndexableObjectWrapper
+from interfaces.portal_catalog import portal_catalog as ICatalogTool
+from permissions import AccessInactivePortalContent
+from permissions import ManagePortal
+from permissions import View
 from utils import _checkPermission
 from utils import _dtmldir
 from utils import _getAuthenticatedUser
 from utils import _mergedLocalRoles
 from utils import getToolByName
-from utils import UniqueObject
 from utils import SimpleRecord
-from ActionProviderBase import ActionProviderBase
-from permissions import AccessInactivePortalContent
-from permissions import ManagePortal
-from permissions import View
-
-from interfaces.portal_catalog \
-        import IndexableObjectWrapper as IIndexableObjectWrapper
-from interfaces.portal_catalog import portal_catalog as ICatalogTool
+from utils import UniqueObject
 
 
 class IndexableObjectWrapper:
@@ -78,7 +76,7 @@
         return list(allowed.keys())
 
 
-class CatalogTool (UniqueObject, ZCatalog, ActionProviderBase):
+class CatalogTool(UniqueObject, ZCatalog, ActionProviderBase):
     """ This is a ZCatalog that filters catalog queries.
     """
 
@@ -156,7 +154,6 @@
                  )
                )
 
-
     security.declarePublic( 'enumerateColumns' )
     def enumerateColumns( self ):
         #   Return a sequence of schema names to be cached.
@@ -244,8 +241,8 @@
                 if kw.has_key(k):
                     range = kw[k]['range'] or ''
                     query = kw[k]['query']
-                    if (not isinstance(query, TupleType) and
-                        not isinstance(query, ListType)):
+                    if (not isinstance(query, tuple) and
+                        not isinstance(query, list)):
                         query = (query,)
                 else:
                     range = ''


=== Products/CMFCore/FSDTMLMethod.py 1.25 => 1.26 ===
--- Products/CMFCore/FSDTMLMethod.py:1.25	Fri Oct 29 16:22:47 2004
+++ Products/CMFCore/FSDTMLMethod.py	Thu Apr  7 12:38:46 2005
@@ -134,7 +134,7 @@
                     self.ZCacheable_set(result)
                 return result
 
-            if type(r) is not type('') or RESPONSE is None:
+            if not isinstance(r, basestring) or RESPONSE is None:
                 if not self._cache_namespace_keys:
                     self.ZCacheable_set(r)
                 return r


=== Products/CMFCore/FSFile.py 1.13 => 1.14 ===
--- Products/CMFCore/FSFile.py:1.13	Sun Nov 14 18:58:30 2004
+++ Products/CMFCore/FSFile.py	Thu Apr  7 12:38:46 2005
@@ -16,19 +16,19 @@
 """
 
 import Globals
-from DateTime import DateTime
 from AccessControl import ClassSecurityInfo
-from webdav.common import rfc1123_date
+from DateTime import DateTime
 from OFS.Cache import Cacheable
-from OFS.Image import File
 from OFS.content_types import guess_content_type
+from OFS.Image import File
+from webdav.common import rfc1123_date
 
-from permissions import FTPAccess
-from permissions import View
-from permissions import ViewManagementScreens
 from DirectoryView import registerFileExtension
 from DirectoryView import registerMetaType
 from FSObject import FSObject
+from permissions import FTPAccess
+from permissions import View
+from permissions import ViewManagementScreens
 from utils import _dtmldir
 from utils import _setCacheHeaders, _ViewEmulator
 from utils import expandpath
@@ -75,7 +75,8 @@
             # Last resort: Use the (imperfect) content type guessing
             # mechanism from OFS.Image, which ultimately uses the
             # Python mimetypes module.
-            if type(body) is not type(''): body=body.data
+            if not isinstance(body, basestring):
+                body = body.data
             content_type, enc=guess_content_type(
                 getattr(file, 'filename',id), body, content_type)
 


=== Products/CMFCore/FSMetadata.py 1.9 => 1.10 ===
--- Products/CMFCore/FSMetadata.py:1.9	Fri Oct 29 14:42:05 2004
+++ Products/CMFCore/FSMetadata.py	Thu Apr  7 12:38:46 2005
@@ -1,3 +1,15 @@
+##############################################################################
+#
+# Copyright (c) 2003 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
 """ Handles reading the properties for an object that comes from the filesystem.
 
 $Id$
@@ -182,7 +194,7 @@
                     c1 = line.index(':')+1
                     c2 = line.index(':',c1)
                     permission = line[:c1-1]
-                    acquire = not not line[c1:c2] # get boolean
+                    acquire = bool(line[c1:c2])
                     proles = line[c2+1:].split(',')
                     roles=[]
                     for role in proles:


=== Products/CMFCore/MembershipTool.py 1.51 => 1.52 ===
--- Products/CMFCore/MembershipTool.py:1.51	Fri Mar 25 12:47:42 2005
+++ Products/CMFCore/MembershipTool.py	Thu Apr  7 12:38:46 2005
@@ -15,8 +15,6 @@
 $Id$
 """
 
-from types import StringType
-
 from AccessControl import ClassSecurityInfo
 from AccessControl.User import nobody
 from Acquisition import aq_base
@@ -469,7 +467,7 @@
         # Delete members in acl_users.
         acl_users = self.acl_users
         if _checkPermission(ManageUsers, acl_users):
-            if type(member_ids) is StringType:
+            if isinstance(member_ids, basestring):
                 member_ids = (member_ids,)
             member_ids = list(member_ids)
             for member_id in member_ids[:]:


=== Products/CMFCore/SkinsTool.py 1.32 => 1.33 ===
--- Products/CMFCore/SkinsTool.py:1.32	Wed Apr  6 09:41:00 2005
+++ Products/CMFCore/SkinsTool.py	Thu Apr  7 12:38:46 2005
@@ -15,14 +15,12 @@
 $Id$
 """
 
-from types import ListType
-
+from AccessControl import ClassSecurityInfo
+from Acquisition import aq_base
+from DateTime import DateTime
 from Globals import DTMLFile
 from Globals import InitializeClass
 from Globals import PersistentMapping
-from Acquisition import aq_base
-from DateTime import DateTime
-from AccessControl import ClassSecurityInfo
 from OFS.DTMLMethod import DTMLMethod
 from OFS.Folder import Folder
 from OFS.Image import Image
@@ -30,14 +28,14 @@
 from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
 from Products.PythonScripts.PythonScript import PythonScript
 
+from ActionProviderBase import ActionProviderBase
 from DirectoryView import base_ignore
 from DirectoryView import ignore
 from DirectoryView import ignore_re
-from ActionProviderBase import ActionProviderBase
+from interfaces.portal_skins import portal_skins as ISkinsTool
 from permissions import AccessContentsInformation
 from permissions import ManagePortal
 from permissions import View
-from interfaces.portal_skins import portal_skins as ISkinsTool
 from SkinsContainer import SkinsContainer
 from utils import _dtmldir
 from utils import getToolByName
@@ -131,7 +129,7 @@
                 # if val is a list from the new lines field
                 # then munge it back into a comma delimited list
                 # for hysterical reasons
-                if isinstance(val, ListType):
+                if isinstance(val, list):
                     val = ','.join([layer.strip() for layer in val])
 
                 if sels[key] != val:
@@ -155,7 +153,7 @@
         skin?
         """
         if skin is None or skin == 'None':
-            skin = self.getDefaultSkin()            
+            skin = self.getDefaultSkin()
         template = self.restrictedTraverse(template_path)
         name = template.getId()
         skin_path = self.getSkinPath(skin)
@@ -363,7 +361,7 @@
                 path_elems.remove(elem)
 
         skinpath = ','.join(path_elems)
-        
+
         if test:
             self.testSkinPath(skinpath)
         sels[str(skinname)] = skinpath


=== Products/CMFCore/WorkflowTool.py 1.50 => 1.51 ===
--- Products/CMFCore/WorkflowTool.py:1.50	Sun Mar 20 15:55:03 2005
+++ Products/CMFCore/WorkflowTool.py	Thu Apr  7 12:38:46 2005
@@ -17,21 +17,24 @@
 
 import sys
 
-from OFS.Folder import Folder
-from Globals import InitializeClass, PersistentMapping, DTMLFile
 from AccessControl import ClassSecurityInfo
 from Acquisition import aq_base, aq_inner, aq_parent
+from Globals import DTMLFile
+from Globals import InitializeClass
+from Globals import PersistentMapping
+from OFS.Folder import Folder
 
 from ActionInformation import getOAI
 from ActionProviderBase import ActionProviderBase
-from permissions import ManagePortal
 from interfaces.portal_workflow import portal_workflow as IWorkflowTool
+from permissions import ManagePortal
 from utils import _dtmldir
 from utils import getToolByName
 from utils import UniqueObject
-from WorkflowCore import WorkflowException
 from WorkflowCore import ObjectDeleted
 from WorkflowCore import ObjectMoved
+from WorkflowCore import WorkflowException
+
 
 AUTO_MIGRATE_WORKFLOW_TOOLS = 0  # Set to 1 to auto-migrate
 
@@ -531,7 +534,7 @@
             the portal_type.
         """
         cbt = self._chains_by_type
-        if type(ob) == type(''):
+        if isinstance(ob, basestring):
             pt = ob
         elif hasattr(aq_base(ob), 'getPortalTypeName'):
             pt = ob.getPortalTypeName()
@@ -666,7 +669,7 @@
             the catalog (sometimes not desirable, e.g. when the workflow
             objects do this themselves only at particular points).
         """
-        self._default_cataloging = not not value
+        self._default_cataloging = bool(value)
 
     security.declarePrivate('_reindexWorkflowVariables')
     def _reindexWorkflowVariables(self, ob):


=== Products/CMFCore/utils.py 1.66 => 1.67 ===
--- Products/CMFCore/utils.py:1.66	Tue Apr  5 05:26:54 2005
+++ Products/CMFCore/utils.py	Thu Apr  7 12:38:46 2005
@@ -99,11 +99,11 @@
 
     o Use 'valueName' to generate appropriate error messages.
     """
-    if type(value) == type(()):
+    if isinstance(value, tuple):
         return value
-    if type(value) == type([]):
+    if isinstance(value, list):
         return tuple( value )
-    if type(value) == type(''):
+    if isinstance(value, basestring):
         return tuple( value.split() )
     raise ValueError, "%s of unsupported type" % valueName
 



More information about the CMF-checkins mailing list