[Checkins] SVN: Products.CMFCore/trunk/Products/CMFCore/ code cleanup:

Yvo Schubbe cvs-admin at zope.org
Tue Apr 24 10:36:02 UTC 2012


Log message for revision 125265:
  code cleanup:
  - replaced has_key
  - replaced oldstyle errors
  - PEP 8

Changed:
  U   Products.CMFCore/trunk/Products/CMFCore/ActionInformation.py
  U   Products.CMFCore/trunk/Products/CMFCore/CMFCatalogAware.py
  U   Products.CMFCore/trunk/Products/CMFCore/CachingPolicyManager.py
  U   Products.CMFCore/trunk/Products/CMFCore/CatalogTool.py
  U   Products.CMFCore/trunk/Products/CMFCore/ContentTypeRegistry.py
  U   Products.CMFCore/trunk/Products/CMFCore/CookieCrumbler.py
  U   Products.CMFCore/trunk/Products/CMFCore/DiscussionTool.py
  U   Products.CMFCore/trunk/Products/CMFCore/FSDTMLMethod.py
  U   Products.CMFCore/trunk/Products/CMFCore/FSFile.py
  U   Products.CMFCore/trunk/Products/CMFCore/FSMetadata.py
  U   Products.CMFCore/trunk/Products/CMFCore/FSObject.py
  U   Products.CMFCore/trunk/Products/CMFCore/FSPageTemplate.py
  U   Products.CMFCore/trunk/Products/CMFCore/FSPythonScript.py
  U   Products.CMFCore/trunk/Products/CMFCore/FSZSQLMethod.py
  U   Products.CMFCore/trunk/Products/CMFCore/MemberDataTool.py
  U   Products.CMFCore/trunk/Products/CMFCore/MembershipTool.py
  U   Products.CMFCore/trunk/Products/CMFCore/Skinnable.py
  U   Products.CMFCore/trunk/Products/CMFCore/TypesTool.py
  U   Products.CMFCore/trunk/Products/CMFCore/WorkflowTool.py
  U   Products.CMFCore/trunk/Products/CMFCore/tests/base/testcase.py
  U   Products.CMFCore/trunk/Products/CMFCore/tests/test_MemberDataTool.py
  U   Products.CMFCore/trunk/Products/CMFCore/utils.py

-=-
Modified: Products.CMFCore/trunk/Products/CMFCore/ActionInformation.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/ActionInformation.py	2012-04-24 10:35:32 UTC (rev 125264)
+++ Products.CMFCore/trunk/Products/CMFCore/ActionInformation.py	2012-04-24 10:35:58 UTC (rev 125265)
@@ -57,7 +57,7 @@
 
         for obj in self.objectValues():
             if IActionCategory.providedBy(obj):
-                actions.extend( obj.listActions() )
+                actions.extend(obj.listActions())
             elif IAction.providedBy(obj):
                 actions.append(obj)
 
@@ -83,12 +83,12 @@
          'label': 'Title'},
         {'id': 'description', 'type': 'text', 'mode': 'w',
          'label': 'Description'},
-        {'id':'i18n_domain', 'type': 'string', 'mode':'w',
-         'label':'I18n Domain'},
+        {'id': 'i18n_domain', 'type': 'string', 'mode': 'w',
+         'label': 'I18n Domain'},
         {'id': 'url_expr', 'type': 'string', 'mode': 'w',
          'label': 'URL (Expression)'},
-        {'id':'link_target', 'type': 'string', 'mode':'w',
-         'label':'Link Target'},
+        {'id': 'link_target', 'type': 'string', 'mode': 'w',
+         'label': 'Link Target'},
         {'id': 'icon_expr', 'type': 'string', 'mode': 'w',
          'label': 'Icon (Expression)'},
         {'id': 'available_expr', 'type': 'string', 'mode': 'w',
@@ -100,20 +100,20 @@
         )
 
     manage_options = (
-        PropertyManager.manage_options
-        + SimpleItem.manage_options)
+        PropertyManager.manage_options +
+        SimpleItem.manage_options)
 
     def __init__(self, id, **kw):
         self.id = id
-        self._setPropValue( 'title', kw.get('title', '') )
-        self._setPropValue( 'description', kw.get('description', '') )
-        self._setPropValue( 'i18n_domain', kw.get('i18n_domain', '') )
-        self._setPropValue( 'url_expr', kw.get('url_expr', '') )
-        self._setPropValue( 'link_target', kw.get('link_target', '') )
-        self._setPropValue( 'icon_expr', kw.get('icon_expr', '') )
-        self._setPropValue( 'available_expr', kw.get('available_expr', '') )
-        self._setPropValue( 'permissions', kw.get('permissions', () ) )
-        self._setPropValue( 'visible', kw.get('visible', True) )
+        self._setPropValue('title', kw.get('title', ''))
+        self._setPropValue('description', kw.get('description', ''))
+        self._setPropValue('i18n_domain', kw.get('i18n_domain', ''))
+        self._setPropValue('url_expr', kw.get('url_expr', ''))
+        self._setPropValue('link_target', kw.get('link_target', ''))
+        self._setPropValue('icon_expr', kw.get('icon_expr', ''))
+        self._setPropValue('available_expr', kw.get('available_expr', ''))
+        self._setPropValue('permissions', kw.get('permissions', ()))
+        self._setPropValue('visible', kw.get('visible', True))
 
     def _setPropValue(self, id, value):
         self._wrapperCheck(value)
@@ -139,7 +139,7 @@
 
         parent = aq_parent(self)
         while parent is not None and parent.getId() != 'portal_actions':
-            category_path.append( parent.getId() )
+            category_path.append(parent.getId())
             parent = aq_parent(parent)
         lazy_map['category'] = '/'.join(category_path[::-1])
 
@@ -174,19 +174,18 @@
     __allow_access_to_unprotected_subobjects__ = 1
 
     def __init__(self, action, ec):
-
         if isinstance(action, dict):
             lazy_keys = []
             UserDict.__init__(self, action)
             if 'name' in self.data:
-                self.data.setdefault( 'id', self.data['name'].lower() )
-                self.data.setdefault( 'title', self.data['name'] )
+                self.data.setdefault('id', self.data['name'].lower())
+                self.data.setdefault('title', self.data['name'])
                 del self.data['name']
-            self.data.setdefault( 'url', '' )
-            self.data.setdefault( 'link_target', None )
-            self.data.setdefault( 'icon', '' )
-            self.data.setdefault( 'category', 'object' )
-            self.data.setdefault( 'visible', True )
+            self.data.setdefault('url', '')
+            self.data.setdefault('link_target', None)
+            self.data.setdefault('icon', '')
+            self.data.setdefault('category', 'object')
+            self.data.setdefault('visible', True)
             self.data['available'] = True
         else:
             # if action isn't a dict, it has to implement IAction
@@ -194,7 +193,7 @@
             UserDict.__init__(self, lazy_map)
 
         self.data.setdefault('allowed', True)
-        permissions = self.data.pop( 'permissions', () )
+        permissions = self.data.pop('permissions', ())
         if permissions:
             self.data['allowed'] = self._checkPermissions
             lazy_keys.append('allowed')
@@ -232,9 +231,9 @@
         """
         category = self['category']
         object = ec.contexts['object']
-        if object is not None and ( category.startswith('object') or
-                                    category.startswith('workflow') or
-                                    category.startswith('document') ):
+        if object is not None and (category.startswith('object') or
+                                   category.startswith('workflow') or
+                                   category.startswith('document')):
             context = object
         else:
             folder = ec.contexts['folder']
@@ -249,7 +248,7 @@
         return False
 
 
-class ActionInformation( SimpleItem ):
+class ActionInformation(SimpleItem):
 
     """ Represent a single selectable action.
 
@@ -265,48 +264,45 @@
 
     security = ClassSecurityInfo()
 
-    def __init__( self
-                , id
-                , title=''
-                , description=''
-                , category='object'
-                , condition=''
-                , permissions=()
-                , priority=10
-                , visible=True
-                , action=''
-                , icon_expr=''
-                , link_target=''
-                ):
+    def __init__(self,
+                 id,
+                 title='',
+                 description='',
+                 category='object',
+                 condition='',
+                 permissions=(),
+                 priority=10,
+                 visible=True,
+                 action='',
+                 icon_expr='',
+                 link_target=''):
         """ Set up an instance.
         """
-        self.edit( id
-                 , title
-                 , description
-                 , category
-                 , condition
-                 , permissions
-                 , priority
-                 , visible
-                 , action
-                 , icon_expr
-                 , link_target
-                 )
+        self.edit(id,
+                  title,
+                  description,
+                  category,
+                  condition,
+                  permissions,
+                  priority,
+                  visible,
+                  action,
+                  icon_expr,
+                  link_target)
 
     security.declarePrivate('edit')
-    def edit( self
-            , id=_unchanged
-            , title=_unchanged
-            , description=_unchanged
-            , category=_unchanged
-            , condition=_unchanged
-            , permissions=_unchanged
-            , priority=_unchanged
-            , visible=_unchanged
-            , action=_unchanged
-            , icon_expr=_unchanged
-            , link_target=_unchanged
-            ):
+    def edit(self,
+             id=_unchanged,
+             title=_unchanged,
+             description=_unchanged,
+             category=_unchanged,
+             condition=_unchanged,
+             permissions=_unchanged,
+             priority=_unchanged,
+             visible=_unchanged,
+             action=_unchanged,
+             icon_expr=_unchanged,
+             link_target=_unchanged):
         """Edit the specified properties.
         """
 
@@ -341,132 +337,120 @@
         if link_target is not _unchanged:
             self.link_target = link_target
 
-    security.declareProtected( View, 'Title' )
+    security.declareProtected(View, 'Title')
     def Title(self):
-
         """ Return the Action title.
         """
         return self.title or self.getId()
 
-    security.declareProtected( View, 'Description' )
-    def Description( self ):
-
+    security.declareProtected(View, 'Description')
+    def Description(self):
         """ Return a description of the action.
         """
         return self.description
 
-    security.declarePrivate( 'testCondition' )
-    def testCondition( self, ec ):
-
+    security.declarePrivate('testCondition')
+    def testCondition(self, ec):
         """ Evaluate condition using context, 'ec', and return 0 or 1.
         """
         if self.condition:
-            return bool( self.condition(ec) )
+            return bool(self.condition(ec))
         else:
             return True
 
-    security.declarePublic( 'getAction' )
-    def getAction( self, ec ):
-
+    security.declarePublic('getAction')
+    def getAction(self, ec):
         """ Compute the action using context, 'ec'; return a mapping of
             info about the action.
         """
         return ActionInfo(self, ec)
 
-    security.declarePrivate( '_getActionObject' )
-    def _getActionObject( self ):
-
+    security.declarePrivate('_getActionObject')
+    def _getActionObject(self):
         """ Find the action object, working around name changes.
         """
-        action = getattr( self, 'action', None )
+        action = getattr(self, 'action', None)
 
         if action is None:  # Forward compatibility, used to be '_action'
-            action = getattr( self, '_action', None )
+            action = getattr(self, '_action', None)
             if action is not None:
                 self.action = self._action
                 del self._action
 
         return action
 
-    security.declarePublic( 'getActionExpression' )
-    def getActionExpression( self ):
-
+    security.declarePublic('getActionExpression')
+    def getActionExpression(self):
         """ Return the text of the TALES expression for our URL.
         """
         action = self._getActionObject()
         expr = action and action.text or ''
         if expr and isinstance(expr, basestring):
-            if ( not expr.startswith('string:')
-                 and not expr.startswith('python:') ):
+            if (not expr.startswith('string:')
+                and not expr.startswith('python:')):
                 expr = 'string:${object_url}/%s' % expr
-                self.action = Expression( expr )
+                self.action = Expression(expr)
         return expr
 
-    security.declarePrivate( 'setActionExpression' )
+    security.declarePrivate('setActionExpression')
     def setActionExpression(self, action):
         if action and isinstance(action, basestring):
-            if ( not action.startswith('string:')
-                 and not action.startswith('python:') ):
+            if (not action.startswith('string:')
+                and not action.startswith('python:')):
                 action = 'string:${object_url}/%s' % action
-            action = Expression( action )
+            action = Expression(action)
         self.action = action
 
-    security.declarePrivate( '_getIconExpressionObject' )
-    def _getIconExpressionObject( self ):
-
+    security.declarePrivate('_getIconExpressionObject')
+    def _getIconExpressionObject(self):
         """ Find the icon expression object, working around name changes.
         """
-        return getattr( self, 'icon_expr', None )
+        return getattr(self, 'icon_expr', None)
 
-    security.declarePublic( 'getIconExpression' )
-    def getIconExpression( self ):
-
+    security.declarePublic('getIconExpression')
+    def getIconExpression(self):
         """ Return the text of the TALES expression for our icon URL.
         """
         icon_expr = self._getIconExpressionObject()
         expr = icon_expr and icon_expr.text or ''
         if expr and isinstance(expr, basestring):
-            if ( not expr.startswith('string:')
-                 and not expr.startswith('python:') ):
+            if (not expr.startswith('string:')
+                and not expr.startswith('python:')):
                 expr = 'string:${object_url}/%s' % expr
-                self.icon_expr = Expression( expr )
+                self.icon_expr = Expression(expr)
         return expr
 
-    security.declarePrivate( 'setIconExpression' )
+    security.declarePrivate('setIconExpression')
     def setIconExpression(self, icon_expr):
         if icon_expr and isinstance(icon_expr, basestring):
-            if ( not icon_expr.startswith('string:')
-                 and not icon_expr.startswith('python:') ):
+            if (not icon_expr.startswith('string:')
+                and not icon_expr.startswith('python:')):
                 icon_expr = 'string:${object_url}/%s' % icon_expr
-            icon_expr = Expression( icon_expr )
+            icon_expr = Expression(icon_expr)
         self.icon_expr = icon_expr
 
-    security.declarePublic( 'getCondition' )
+    security.declarePublic('getCondition')
     def getCondition(self):
-
         """ Return the text of the TALES expression for our condition.
         """
-        return getattr( self, 'condition', None ) and self.condition.text or ''
+        return getattr(self, 'condition', None) and self.condition.text or ''
 
-    security.declarePublic( 'getPermissions' )
-    def getPermissions( self ):
-
+    security.declarePublic('getPermissions')
+    def getPermissions(self):
         """ Return the permission, if any, required to execute the action.
 
         Return an empty tuple if no permission is required.
         """
         return self.permissions
 
-    security.declarePublic( 'getCategory' )
-    def getCategory( self ):
-
+    security.declarePublic('getCategory')
+    def getCategory(self):
         """ Return the category in which the action should be grouped.
         """
         return self.category or 'object'
 
-    security.declarePublic( 'getVisibility' )
-    def getVisibility( self ):
-
+    security.declarePublic('getVisibility')
+    def getVisibility(self):
         """ Return whether the action should be visible in the CMF UI.
         """
         return bool(self.visible)
@@ -481,23 +465,23 @@
     def getMapping(self):
         """ Get a mapping of this object's data.
         """
-        return { 'id': self.id,
-                 'title': self.title or self.id,
-                 'description': self.description,
-                 'category': self.category or 'object',
-                 'condition': getattr(self, 'condition', None)
-                              and self.condition.text or '',
-                 'permissions': self.permissions,
-                 'visible': bool(self.visible),
-                 'action': self.getActionExpression(),
-                 'icon_expr' : self.getIconExpression(),
-                 'link_target' : self.getLinkTarget() }
+        return {'id': self.id,
+                'title': self.title or self.id,
+                'description': self.description,
+                'category': self.category or 'object',
+                'condition': getattr(self, 'condition', None)
+                             and self.condition.text or '',
+                'permissions': self.permissions,
+                'visible': bool(self.visible),
+                'action': self.getActionExpression(),
+                'icon_expr': self.getIconExpression(),
+                'link_target': self.getLinkTarget()}
 
     security.declarePrivate('clone')
-    def clone( self ):
+    def clone(self):
         """ Get a newly-created AI just like us.
         """
-        return self.__class__( priority=self.priority, **self.getMapping() )
+        return self.__class__(priority=self.priority, **self.getMapping())
 
     security.declarePrivate('getInfoData')
     def getInfoData(self):
@@ -532,7 +516,7 @@
 
         return (lazy_map, lazy_keys)
 
-InitializeClass( ActionInformation )
+InitializeClass(ActionInformation)
 
 
 def getOAI(context, object=None):
@@ -541,7 +525,7 @@
         cache = request.get('_oai_cache', None)
         if cache is None:
             request['_oai_cache'] = cache = {}
-        info = cache.get( id(object), None )
+        info = cache.get(id(object), None)
     else:
         info = None
     if info is None:
@@ -559,7 +543,7 @@
                     folder = aq_parent(aq_inner(folder))
         info = oai(context, folder, object)
         if request:
-            cache[ id(object) ] = info
+            cache[id(object)] = info
     return info
 
 
@@ -570,7 +554,7 @@
     # available actions.
     __allow_access_to_unprotected_subobjects__ = 1
 
-    def __init__( self, tool, folder, object=None ):
+    def __init__(self, tool, folder, object=None):
         self.portal = portal = aq_parent(aq_inner(tool))
         mtool = getUtility(IMembershipTool)
         self.isAnonymous = mtool.isAnonymousUser()
@@ -593,7 +577,7 @@
     def __getitem__(self, name):
         # Mapping interface for easy string formatting.
         if name[:1] == '_':
-            raise KeyError, name
+            raise KeyError(name)
         if hasattr(self, name):
             return getattr(self, name)
-        raise KeyError, name
+        raise KeyError(name)

Modified: Products.CMFCore/trunk/Products/CMFCore/CMFCatalogAware.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/CMFCatalogAware.py	2012-04-24 10:35:32 UTC (rev 125264)
+++ Products.CMFCore/trunk/Products/CMFCore/CMFCatalogAware.py	2012-04-24 10:35:58 UTC (rev 125265)
@@ -120,7 +120,8 @@
             s = getattr(ob, '_p_changed', 0)
             catalog.reindexObject(ob, idxs=self._cmf_security_indexes,
                                   update_metadata=0, uid=brain_path)
-            if s is None: ob._p_deactivate()
+            if s is None:
+                ob._p_deactivate()
 
 InitializeClass(CatalogAware)
 
@@ -134,8 +135,7 @@
 
     security = ClassSecurityInfo()
 
-    manage_options = ({'label': 'Workflows',
-                       'action': 'manage_workflowsTab'},)
+    manage_options = ({'label': 'Workflows', 'action': 'manage_workflowsTab'},)
 
     _manage_workflowsTab = DTMLFile('zmi_workflows', _dtmldir)
 

Modified: Products.CMFCore/trunk/Products/CMFCore/CachingPolicyManager.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/CachingPolicyManager.py	2012-04-24 10:35:32 UTC (rev 125264)
+++ Products.CMFCore/trunk/Products/CMFCore/CachingPolicyManager.py	2012-04-24 10:35:58 UTC (rev 125265)
@@ -54,7 +54,7 @@
     )
 
 
-def createCPContext( content, view_method, keywords, time=None ):
+def createCPContext(content, view_method, keywords, time=None):
     """
         Construct an expression context for TALES expressions,
         for use by CachingPolicy objects.
@@ -70,19 +70,19 @@
 
     # The name "content" is deprecated and will go away in CMF 2.0,
     # please use "object" in your policy
-    data = { 'content'  : content
-           , 'object'   : content
-           , 'view'     : view_method
-           , 'keywords' : keywords
-           , 'request'  : getattr( content, 'REQUEST', {} )
-           , 'member'   : member
-           , 'modules'  : SecureModuleImporter
-           , 'nothing'  : None
-           , 'time'     : time
-           }
+    data = {'content': content,
+            'object': content,
+            'view': view_method,
+            'keywords': keywords,
+            'request': getattr(content, 'REQUEST', {}),
+            'member': member,
+            'modules': SecureModuleImporter,
+            'nothing': None,
+            'time': time}
 
-    return getEngine().getContext( data )
+    return getEngine().getContext(data)
 
+
 class CPMCache(Cache):
     """ Simple OFS.Cache-implementation
     """
@@ -92,7 +92,7 @@
     def ZCache_invalidate(self, ob):
         """ An object is forced out of the cache
 
-        This implementation stores nothing and does not attempt to 
+        This implementation stores nothing and does not attempt to
         communicate with cache servers, so this is a no-op.
         """
         pass
@@ -158,17 +158,17 @@
             set using 's_max_age_secs', if passed;  it should be an integer
             value in seconds.
 
-          - The "Vary" HTTP response headers will be set if a value is 
+          - The "Vary" HTTP response headers will be set if a value is
             provided. The Vary header is described in RFC 2616. In essence,
             it instructs caches that respect this header (such as Squid
             after version 2.4) to distinguish between requests not just by
             the request URL, but also by values found in the headers showing
-            in the Vary tag. "Vary: Cookie" would force Squid to also take 
-            Cookie headers into account when deciding what cached object to 
+            in the Vary tag. "Vary: Cookie" would force Squid to also take
+            Cookie headers into account when deciding what cached object to
             choose and serve in response to a request.
 
           - The "ETag" HTTP response header will be set if a value is
-            provided. The value is a TALES expression and the result 
+            provided. The value is a TALES expression and the result
             after evaluation will be used as the ETag header value.
 
           - Other tokens will be added to the "Cache-control" HTTP response
@@ -210,27 +210,25 @@
 
     implements(ICachingPolicy)
 
-    def __init__( self
-                , policy_id
-                , predicate=''
-                , mtime_func=''
-                , max_age_secs=None
-                , no_cache=0
-                , no_store=0
-                , must_revalidate=0
-                , vary=''
-                , etag_func=''
-                , s_max_age_secs=None
-                , proxy_revalidate=0
-                , public=0
-                , private=0
-                , no_transform=0
-                , enable_304s=0
-                , last_modified=1
-                , pre_check=None
-                , post_check=None
-                ):
-
+    def __init__(self,
+                 policy_id,
+                 predicate='',
+                 mtime_func='',
+                 max_age_secs=None,
+                 no_cache=0,
+                 no_store=0,
+                 must_revalidate=0,
+                 vary='',
+                 etag_func='',
+                 s_max_age_secs=None,
+                 proxy_revalidate=0,
+                 public=0,
+                 private=0,
+                 no_transform=0,
+                 enable_304s=0,
+                 last_modified=1,
+                 pre_check=None,
+                 post_check=None):
         if not predicate:
             predicate = 'python:1'
 
@@ -241,13 +239,13 @@
             if str(max_age_secs).strip() == '':
                 max_age_secs = None
             else:
-                max_age_secs = int( max_age_secs )
+                max_age_secs = int(max_age_secs)
 
         if s_max_age_secs is not None:
             if str(s_max_age_secs).strip() == '':
                 s_max_age_secs = None
             else:
-                s_max_age_secs = int( s_max_age_secs )
+                s_max_age_secs = int(s_max_age_secs)
 
         if pre_check is not None:
             if str(pre_check).strip() == '':
@@ -262,90 +260,90 @@
                 post_check = int(post_check)
 
         self._policy_id = policy_id
-        self._predicate = Expression( text=predicate )
-        self._mtime_func = Expression( text=mtime_func )
+        self._predicate = Expression(text=predicate)
+        self._mtime_func = Expression(text=mtime_func)
         self._max_age_secs = max_age_secs
         self._s_max_age_secs = s_max_age_secs
-        self._no_cache = int( no_cache )
-        self._no_store = int( no_store )
-        self._must_revalidate = int( must_revalidate )
-        self._proxy_revalidate = int( proxy_revalidate )
-        self._public = int( public )
-        self._private = int( private )
-        self._no_transform = int( no_transform )
+        self._no_cache = int(no_cache)
+        self._no_store = int(no_store)
+        self._must_revalidate = int(must_revalidate)
+        self._proxy_revalidate = int(proxy_revalidate)
+        self._public = int(public)
+        self._private = int(private)
+        self._no_transform = int(no_transform)
         self._vary = vary
-        self._etag_func = Expression( text=etag_func )
-        self._enable_304s = int ( enable_304s )
-        self._last_modified = int( last_modified )
+        self._etag_func = Expression(text=etag_func)
+        self._enable_304s = int(enable_304s)
+        self._last_modified = int(last_modified)
         self._pre_check = pre_check
         self._post_check = post_check
 
-    def getPolicyId( self ):
+    def getPolicyId(self):
         """
         """
         return self._policy_id
 
-    def getPredicate( self ):
+    def getPredicate(self):
         """
         """
         return self._predicate.text
 
-    def getMTimeFunc( self ):
+    def getMTimeFunc(self):
         """
         """
         return self._mtime_func.text
 
-    def getMaxAgeSecs( self ):
+    def getMaxAgeSecs(self):
         """
         """
         return self._max_age_secs
 
-    def getSMaxAgeSecs( self ):
+    def getSMaxAgeSecs(self):
         """
         """
         return getattr(self, '_s_max_age_secs', None)
 
-    def getNoCache( self ):
+    def getNoCache(self):
         """
         """
         return self._no_cache
 
-    def getNoStore( self ):
+    def getNoStore(self):
         """
         """
         return self._no_store
 
-    def getMustRevalidate( self ):
+    def getMustRevalidate(self):
         """
         """
         return self._must_revalidate
 
-    def getProxyRevalidate( self ):
+    def getProxyRevalidate(self):
         """
         """
         return getattr(self, '_proxy_revalidate', 0)
 
-    def getPublic( self ):
+    def getPublic(self):
         """
         """
         return getattr(self, '_public', 0)
 
-    def getPrivate( self ):
+    def getPrivate(self):
         """
         """
         return getattr(self, '_private', 0)
 
-    def getNoTransform( self ):
+    def getNoTransform(self):
         """
         """
         return getattr(self, '_no_transform', 0)
 
-    def getVary( self ):
+    def getVary(self):
         """
         """
         return getattr(self, '_vary', '')
 
-    def getETagFunc( self ):
+    def getETagFunc(self):
         """
         """
         etag_func_text = ''
@@ -379,7 +377,7 @@
         """ Does this request match our predicate?"""
         return self._predicate(expr_context)
 
-    def getHeaders( self, expr_context ):
+    def getHeaders(self, expr_context):
         """
             Does this request match our predicate?  If so, return a
             sequence of caching headers as ( key, value ) tuples.
@@ -387,49 +385,50 @@
         """
         headers = []
 
-        if self.testPredicate( expr_context ):
+        if self.testPredicate(expr_context):
 
             if self.getLastModified():
-                mtime = self._mtime_func( expr_context )
-                if type( mtime ) is type( '' ):
-                    mtime = DateTime( mtime )
+                mtime = self._mtime_func(expr_context)
+                if type(mtime) is type(''):
+                    mtime = DateTime(mtime)
                 if mtime is not None:
                     mtime_str = rfc1123_date(mtime.timeTime())
-                    headers.append( ( 'Last-modified', mtime_str ) )
+                    headers.append(('Last-modified', mtime_str))
 
             control = []
 
             if self.getMaxAgeSecs() is not None:
-                now = expr_context.vars[ 'time' ]
-                exp_time_str = rfc1123_date(now.timeTime() + self._max_age_secs)
-                headers.append( ( 'Expires', exp_time_str ) )
-                control.append( 'max-age=%d' % self._max_age_secs )
+                now = expr_context.vars['time']
+                exp_time_str = rfc1123_date(now.timeTime()
+                                            + self._max_age_secs)
+                headers.append(('Expires', exp_time_str))
+                control.append('max-age=%d' % self._max_age_secs)
 
             if self.getSMaxAgeSecs() is not None:
-                control.append( 's-maxage=%d' % self._s_max_age_secs )
+                control.append('s-maxage=%d' % self._s_max_age_secs)
 
             if self.getNoCache():
-                control.append( 'no-cache' )
+                control.append('no-cache')
                 # The following is for HTTP 1.0 clients
                 headers.append(('Pragma', 'no-cache'))
 
             if self.getNoStore():
-                control.append( 'no-store' )
+                control.append('no-store')
 
             if self.getPublic():
-                control.append( 'public' )
+                control.append('public')
 
             if self.getPrivate():
-                control.append( 'private' )
+                control.append('private')
 
             if self.getMustRevalidate():
-                control.append( 'must-revalidate' )
+                control.append('must-revalidate')
 
             if self.getProxyRevalidate():
-                control.append( 'proxy-revalidate' )
+                control.append('proxy-revalidate')
 
             if self.getNoTransform():
-                control.append( 'no-transform' )
+                control.append('no-transform')
 
             pre_check = self.getPreCheck()
             if pre_check is not None:
@@ -440,19 +439,18 @@
                 control.append('post-check=%d' % post_check)
 
             if control:
-                headers.append( ( 'Cache-control', ', '.join( control ) ) )
+                headers.append(('Cache-control', ', '.join(control)))
 
             if self.getVary():
-                headers.append( ( 'Vary', self._vary ) )
+                headers.append(('Vary', self._vary))
 
             if self.getETagFunc():
-                headers.append( ( 'ETag', self._etag_func( expr_context ) ) )
+                headers.append(('ETag', self._etag_func(expr_context)))
 
         return headers
 
 
-
-class CachingPolicyManager( SimpleItem, CacheManager ):
+class CachingPolicyManager(SimpleItem, CacheManager):
     """
         Manage the set of CachingPolicy objects for the site;  dispatch
         to them from skin methods.
@@ -466,54 +464,49 @@
 
     security = ClassSecurityInfo()
 
-    def __init__( self ):
+    def __init__(self):
         self._policy_ids = ()
         self._policies = PersistentMapping()
 
     #
     #   ZMI
     #
-    manage_options = ( ( { 'label'  : 'Policies'
-                         , 'action' : 'manage_cachingPolicies'
-                         , 'help'   : ('CMFCore', 'CPMPolicies.stx')
-                         }
-                       ,
-                       )
-                     + CacheManager.manage_options
-                     + SimpleItem.manage_options
-                     )
+    manage_options = (
+        ({'label': 'Policies', 'action': 'manage_cachingPolicies',
+          'help': ('CMFCore', 'CPMPolicies.stx')},) +
+        CacheManager.manage_options +
+        SimpleItem.manage_options)
 
-    security.declareProtected( ManagePortal, 'manage_cachingPolicies' )
-    manage_cachingPolicies = DTMLFile( 'cachingPolicies', _dtmldir )
+    security.declareProtected(ManagePortal, 'manage_cachingPolicies')
+    manage_cachingPolicies = DTMLFile('cachingPolicies', _dtmldir)
 
-    security.declarePublic( 'listPolicies' )
-    def listPolicies( self ):
+    security.declarePublic('listPolicies')
+    def listPolicies(self):
         """List '(id, (policy, typeObjectName))' tuples for all policies.
         """
         return tuple([ (id, self._policies[id]) for id in self._policy_ids ])
 
-    security.declareProtected( ManagePortal, 'addPolicy' )
-    def addPolicy( self
-                 , policy_id
-                 , predicate           # TALES expr (def. 'python:1')
-                 , mtime_func          # TALES expr (def. 'object/modified')
-                 , max_age_secs        # integer, seconds (def. 0)
-                 , no_cache            # boolean (def. 0)
-                 , no_store            # boolean (def. 0)
-                 , must_revalidate     # boolean (def. 0)
-                 , vary                # string value
-                 , etag_func           # TALES expr (def. '')
-                 , REQUEST=None
-                 , s_max_age_secs=None # integer, seconds (def. None)
-                 , proxy_revalidate=0  # boolean (def. 0)
-                 , public=0            # boolean (def. 0)
-                 , private=0           # boolean (def. 0)
-                 , no_transform=0      # boolean (def. 0)
-                 , enable_304s=0       # boolean (def. 0)
-                 , last_modified=1     # boolean (def. 1)
-                 , pre_check=None      # integer, default None
-                 , post_check=None     # integer, default None
-                 ):
+    security.declareProtected(ManagePortal, 'addPolicy')
+    def addPolicy(self,
+                  policy_id,
+                  predicate, # TALES expr (def. 'python:1')
+                  mtime_func, # TALES expr (def. 'object/modified')
+                  max_age_secs, # integer, seconds (def. 0)
+                  no_cache, # boolean (def. 0)
+                  no_store, # boolean (def. 0)
+                  must_revalidate, # boolean (def. 0)
+                  vary, # string value
+                  etag_func, # TALES expr (def. '')
+                  REQUEST=None,
+                  s_max_age_secs=None, # integer, seconds (def. None)
+                  proxy_revalidate=0, # boolean (def. 0)
+                  public=0, # boolean (def. 0)
+                  private=0, # boolean (def. 0)
+                  no_transform=0, # boolean (def. 0)
+                  enable_304s=0, # boolean (def. 0)
+                  last_modified=1, # boolean (def. 1)
+                  pre_check=None, # integer, default None
+                  post_check=None): # integer, default None
         """
             Add a caching policy.
         """
@@ -537,54 +530,51 @@
         else:
             post_check = int(post_check)
 
-        self._addPolicy( policy_id
-                       , predicate
-                       , mtime_func
-                       , max_age_secs
-                       , no_cache
-                       , no_store
-                       , must_revalidate
-                       , vary
-                       , etag_func
-                       , s_max_age_secs
-                       , proxy_revalidate
-                       , public
-                       , private
-                       , no_transform
-                       , enable_304s
-                       , last_modified
-                       , pre_check
-                       , post_check
-                       )
-        if REQUEST is not None: 
-            REQUEST[ 'RESPONSE' ].redirect( self.absolute_url()
-                                          + '/manage_cachingPolicies'
-                                          + '?manage_tabs_message='
-                                          + 'Policy+added.'
-                                          )
+        self._addPolicy(policy_id,
+                        predicate,
+                        mtime_func,
+                        max_age_secs,
+                        no_cache,
+                        no_store,
+                        must_revalidate,
+                        vary,
+                        etag_func,
+                        s_max_age_secs,
+                        proxy_revalidate,
+                        public,
+                        private,
+                        no_transform,
+                        enable_304s,
+                        last_modified,
+                        pre_check,
+                        post_check)
+        if REQUEST is not None:
+            REQUEST['RESPONSE'].redirect(self.absolute_url()
+                                         + '/manage_cachingPolicies'
+                                         + '?manage_tabs_message='
+                                         + 'Policy+added.')
 
-    security.declareProtected( ManagePortal, 'updatePolicy' )
-    def updatePolicy( self
-                    , policy_id
-                    , predicate           # TALES expr (def. 'python:1')
-                    , mtime_func          # TALES expr (def. 'object/modified')
-                    , max_age_secs        # integer, seconds (def. 0)
-                    , no_cache            # boolean (def. 0)
-                    , no_store            # boolean (def. 0)
-                    , must_revalidate     # boolean (def. 0)
-                    , vary                # string value
-                    , etag_func           # TALES expr (def. '')
-                    , REQUEST=None
-                    , s_max_age_secs=None # integer, seconds (def. 0)
-                    , proxy_revalidate=0  # boolean (def. 0)
-                    , public=0            # boolean (def. 0)
-                    , private=0           # boolean (def. 0)
-                    , no_transform=0      # boolean (def. 0)
-                    , enable_304s=0       # boolean (def. 0)
-                    , last_modified=1     # boolean (def. 1)
-                    , pre_check=0         # integer, default=None
-                    , post_check=0        # integer, default=None
-                    ):
+    security.declareProtected(ManagePortal, 'updatePolicy')
+    def updatePolicy(self,
+                     policy_id,
+                     predicate, # TALES expr (def. 'python:1')
+                     mtime_func, # TALES expr (def. 'object/modified')
+                     max_age_secs, # integer, seconds (def. 0)
+                     no_cache, # boolean (def. 0)
+                     no_store, # boolean (def. 0)
+                     must_revalidate, # boolean (def. 0)
+                     vary, # string value
+                     etag_func, # TALES expr (def. '')
+                     REQUEST=None,
+                     s_max_age_secs=None, # integer, seconds (def. 0)
+                     proxy_revalidate=0, # boolean (def. 0)
+                     public=0, # boolean (def. 0)
+                     private=0, # boolean (def. 0)
+                     no_transform=0, # boolean (def. 0)
+                     enable_304s=0, # boolean (def. 0)
+                     last_modified=1, # boolean (def. 1)
+                     pre_check=0, # integer, default=None
+                     post_check=0): # integer, default=None
         """
             Update a caching policy.
         """
@@ -608,215 +598,205 @@
         else:
             post_check = int(post_check)
 
-        self._updatePolicy( policy_id
-                          , predicate
-                          , mtime_func
-                          , max_age_secs
-                          , no_cache
-                          , no_store
-                          , must_revalidate
-                          , vary
-                          , etag_func
-                          , s_max_age_secs
-                          , proxy_revalidate
-                          , public
-                          , private
-                          , no_transform
-                          , enable_304s
-                          , last_modified
-                          , pre_check
-                          , post_check
-                          )
-        if REQUEST is not None: 
-            REQUEST[ 'RESPONSE' ].redirect( self.absolute_url()
-                                          + '/manage_cachingPolicies'
-                                          + '?manage_tabs_message='
-                                          + 'Policy+updated.'
-                                          )
+        self._updatePolicy(policy_id,
+                           predicate,
+                           mtime_func,
+                           max_age_secs,
+                           no_cache,
+                           no_store,
+                           must_revalidate,
+                           vary,
+                           etag_func,
+                           s_max_age_secs,
+                           proxy_revalidate,
+                           public,
+                           private,
+                           no_transform,
+                           enable_304s,
+                           last_modified,
+                           pre_check,
+                           post_check)
+        if REQUEST is not None:
+            REQUEST['RESPONSE'].redirect(self.absolute_url()
+                                         + '/manage_cachingPolicies'
+                                         + '?manage_tabs_message='
+                                         + 'Policy+updated.')
 
-    security.declareProtected( ManagePortal, 'movePolicyUp' )
-    def movePolicyUp( self, policy_id, REQUEST=None ):
+    security.declareProtected(ManagePortal, 'movePolicyUp')
+    def movePolicyUp(self, policy_id, REQUEST=None):
         """
             Move a caching policy up in the list.
         """
-        policy_ids = list( self._policy_ids )
-        ndx = policy_ids.index( policy_id )
+        policy_ids = list(self._policy_ids)
+        ndx = policy_ids.index(policy_id)
         if ndx == 0:
             msg = "Policy+already+first."
         else:
-            self._reorderPolicy( policy_id, ndx - 1 )
+            self._reorderPolicy(policy_id, ndx - 1)
             msg = "Policy+moved."
         if REQUEST is not None:
-            REQUEST[ 'RESPONSE' ].redirect( self.absolute_url()
-                              + '/manage_cachingPolicies'
-                              + '?manage_tabs_message=%s' % msg
-                              )
+            REQUEST['RESPONSE'].redirect(self.absolute_url()
+                                         + '/manage_cachingPolicies'
+                                         + '?manage_tabs_message=%s' % msg)
 
-    security.declareProtected( ManagePortal, 'movePolicyDown' )
-    def movePolicyDown( self, policy_id, REQUEST=None ):
+    security.declareProtected(ManagePortal, 'movePolicyDown')
+    def movePolicyDown(self, policy_id, REQUEST=None):
         """
             Move a caching policy down in the list.
         """
-        policy_ids = list( self._policy_ids )
-        ndx = policy_ids.index( policy_id )
-        if ndx == len( policy_ids ) - 1:
+        policy_ids = list(self._policy_ids)
+        ndx = policy_ids.index(policy_id)
+        if ndx == len(policy_ids) - 1:
             msg = "Policy+already+last."
         else:
-            self._reorderPolicy( policy_id, ndx + 1 )
+            self._reorderPolicy(policy_id, ndx + 1)
             msg = "Policy+moved."
         if REQUEST is not None:
-            REQUEST[ 'RESPONSE' ].redirect( self.absolute_url()
-                              + '/manage_cachingPolicies'
-                              + '?manage_tabs_message=%s' % msg
-                              )
+            REQUEST['RESPONSE'].redirect(self.absolute_url()
+                                         + '/manage_cachingPolicies'
+                                         + '?manage_tabs_message=%s' % msg)
 
-    security.declareProtected( ManagePortal, 'removePolicy' )
-    def removePolicy( self, policy_id, REQUEST=None ):
+    security.declareProtected(ManagePortal, 'removePolicy')
+    def removePolicy(self, policy_id, REQUEST=None):
         """
             Remove a caching policy.
         """
-        self._removePolicy( policy_id )
+        self._removePolicy(policy_id)
         if REQUEST is not None:
-            REQUEST[ 'RESPONSE' ].redirect( self.absolute_url()
-                              + '/manage_cachingPolicies'
-                              + '?manage_tabs_message=Policy+removed.'
-                              )
+            REQUEST['RESPONSE'].redirect(self.absolute_url()
+                                      + '/manage_cachingPolicies'
+                                      + '?manage_tabs_message=Policy+removed.')
 
     #
     #   Policy manipulation methods.
     #
-    security.declarePrivate( '_addPolicy' )
-    def _addPolicy( self
-                  , policy_id
-                  , predicate
-                  , mtime_func
-                  , max_age_secs
-                  , no_cache
-                  , no_store
-                  , must_revalidate
-                  , vary
-                  , etag_func
-                  , s_max_age_secs=None
-                  , proxy_revalidate=0
-                  , public=0
-                  , private=0
-                  , no_transform=0
-                  , enable_304s=0
-                  , last_modified=1
-                  , pre_check=None
-                  , post_check=None
-                  ):
+    security.declarePrivate('_addPolicy')
+    def _addPolicy(self,
+                   policy_id,
+                   predicate,
+                   mtime_func,
+                   max_age_secs,
+                   no_cache,
+                   no_store,
+                   must_revalidate,
+                   vary,
+                   etag_func,
+                   s_max_age_secs=None,
+                   proxy_revalidate=0,
+                   public=0,
+                   private=0,
+                   no_transform=0,
+                   enable_304s=0,
+                   last_modified=1,
+                   pre_check=None,
+                   post_check=None):
         """
             Add a policy to our registry.
         """
-        policy_id = str( policy_id ).strip()
+        policy_id = str(policy_id).strip()
 
         if not policy_id:
-            raise ValueError, "Policy ID is required!"
+            raise ValueError("Policy ID is required!")
 
         if policy_id in self._policy_ids:
-            raise KeyError, "Policy %s already exists!" % policy_id
+            raise KeyError("Policy %s already exists!" % policy_id)
 
-        self._policies[ policy_id ] = CachingPolicy( policy_id
-                                                   , predicate
-                                                   , mtime_func
-                                                   , max_age_secs
-                                                   , no_cache
-                                                   , no_store
-                                                   , must_revalidate
-                                                   , vary
-                                                   , etag_func
-                                                   , s_max_age_secs
-                                                   , proxy_revalidate
-                                                   , public
-                                                   , private
-                                                   , no_transform
-                                                   , enable_304s
-                                                   , last_modified
-                                                   , pre_check
-                                                   , post_check
-                                                   )
-        idlist = list( self._policy_ids )
-        idlist.append( policy_id )
-        self._policy_ids = tuple( idlist )
+        self._policies[policy_id] = CachingPolicy(policy_id,
+                                                  predicate,
+                                                  mtime_func,
+                                                  max_age_secs,
+                                                  no_cache,
+                                                  no_store,
+                                                  must_revalidate,
+                                                  vary,
+                                                  etag_func,
+                                                  s_max_age_secs,
+                                                  proxy_revalidate,
+                                                  public,
+                                                  private,
+                                                  no_transform,
+                                                  enable_304s,
+                                                  last_modified,
+                                                  pre_check,
+                                                  post_check)
+        idlist = list(self._policy_ids)
+        idlist.append(policy_id)
+        self._policy_ids = tuple(idlist)
 
-    security.declarePrivate( '_updatePolicy' )
-    def _updatePolicy( self
-                     , policy_id
-                     , predicate
-                     , mtime_func
-                     , max_age_secs
-                     , no_cache
-                     , no_store
-                     , must_revalidate
-                     , vary
-                     , etag_func
-                     , s_max_age_secs=None
-                     , proxy_revalidate=0
-                     , public=0
-                     , private=0
-                     , no_transform=0
-                     , enable_304s=0
-                     , last_modified=1
-                     , pre_check=None
-                     , post_check=None
-                     ):
+    security.declarePrivate('_updatePolicy')
+    def _updatePolicy(self,
+                      policy_id,
+                      predicate,
+                      mtime_func,
+                      max_age_secs,
+                      no_cache,
+                      no_store,
+                      must_revalidate,
+                      vary,
+                      etag_func,
+                      s_max_age_secs=None,
+                      proxy_revalidate=0,
+                      public=0,
+                      private=0,
+                      no_transform=0,
+                      enable_304s=0,
+                      last_modified=1,
+                      pre_check=None,
+                      post_check=None):
         """
             Update a policy in our registry.
         """
         if policy_id not in self._policy_ids:
-            raise KeyError, "Policy %s does not exist!" % policy_id
+            raise KeyError("Policy %s does not exist!" % policy_id)
 
-        self._policies[ policy_id ] = CachingPolicy( policy_id
-                                                   , predicate
-                                                   , mtime_func
-                                                   , max_age_secs
-                                                   , no_cache
-                                                   , no_store
-                                                   , must_revalidate
-                                                   , vary
-                                                   , etag_func
-                                                   , s_max_age_secs
-                                                   , proxy_revalidate
-                                                   , public
-                                                   , private
-                                                   , no_transform
-                                                   , enable_304s
-                                                   , last_modified
-                                                   , pre_check
-                                                   , post_check
-                                                   )
+        self._policies[policy_id] = CachingPolicy(policy_id,
+                                                  predicate,
+                                                  mtime_func,
+                                                  max_age_secs,
+                                                  no_cache,
+                                                  no_store,
+                                                  must_revalidate,
+                                                  vary,
+                                                  etag_func,
+                                                  s_max_age_secs,
+                                                  proxy_revalidate,
+                                                  public,
+                                                  private,
+                                                  no_transform,
+                                                  enable_304s,
+                                                  last_modified,
+                                                  pre_check,
+                                                  post_check)
 
-    security.declarePrivate( '_reorderPolicy' )
-    def _reorderPolicy( self, policy_id, newIndex ):
+    security.declarePrivate('_reorderPolicy')
+    def _reorderPolicy(self, policy_id, newIndex):
         """
             Reorder a policy in our registry.
         """
         if policy_id not in self._policy_ids:
-            raise KeyError, "Policy %s does not exist!" % policy_id
+            raise KeyError("Policy %s does not exist!" % policy_id)
 
-        idlist = list( self._policy_ids )
-        ndx = idlist.index( policy_id )
-        pred = idlist[ ndx ]
-        idlist = idlist[ :ndx ] + idlist[ ndx+1: ]
-        idlist.insert( newIndex, pred )
-        self._policy_ids = tuple( idlist )
+        idlist = list(self._policy_ids)
+        ndx = idlist.index(policy_id)
+        pred = idlist[ndx]
+        idlist = idlist[:ndx] + idlist[ndx + 1:]
+        idlist.insert(newIndex, pred)
+        self._policy_ids = tuple(idlist)
 
-    security.declarePrivate( '_removePolicy' )
-    def _removePolicy( self, policy_id ):
+    security.declarePrivate('_removePolicy')
+    def _removePolicy(self, policy_id):
         """
             Remove a policy from our registry.
         """
         if policy_id not in self._policy_ids:
-            raise KeyError, "Policy %s does not exist!" % policy_id
+            raise KeyError("Policy %s does not exist!" % policy_id)
 
-        del self._policies[ policy_id ]
-        idlist = list( self._policy_ids )
-        ndx = idlist.index( policy_id )
-        idlist = idlist[ :ndx ] + idlist[ ndx+1: ]
-        self._policy_ids = tuple( idlist )
+        del self._policies[policy_id]
+        idlist = list(self._policy_ids)
+        ndx = idlist.index(policy_id)
+        idlist = idlist[:ndx] + idlist[ndx + 1:]
+        self._policy_ids = tuple(idlist)
 
-
     #
     #   'portal_caching' interface methods
     #
@@ -899,16 +879,15 @@
                 setattr(event.oldParent, ZCM_MANAGERS, tuple(ids))
 
 
-def manage_addCachingPolicyManager( self, REQUEST=None ):
+def manage_addCachingPolicyManager(self, REQUEST=None):
     """
         Add a CPM to self.
     """
     id = CachingPolicyManager.id
     mgr = CachingPolicyManager()
-    self._setObject( id, mgr )
+    self._setObject(id, mgr)
 
     if REQUEST is not None:
-        REQUEST[ 'RESPONSE' ].redirect( self.absolute_url()
-                      + '/manage_main'
-                      + '?manage_tabs_message=Caching+Policy+Manager+added.'
-                      )
+        REQUEST['RESPONSE'].redirect(self.absolute_url()
+                        + '/manage_main'
+                        + '?manage_tabs_message=Caching+Policy+Manager+added.')

Modified: Products.CMFCore/trunk/Products/CMFCore/CatalogTool.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/CatalogTool.py	2012-04-24 10:35:32 UTC (rev 125264)
+++ Products.CMFCore/trunk/Products/CMFCore/CatalogTool.py	2012-04-24 10:35:58 UTC (rev 125265)
@@ -50,7 +50,7 @@
 class IndexableObjectSpecification(ObjectSpecificationDescriptor):
 
     # This class makes the wrapper transparent, adapter lookup is
-    # carried out based on the interfaces of the wrapped object. 
+    # carried out based on the interfaces of the wrapped object.
 
     def __get__(self, inst, cls=None):
         if inst is None:
@@ -85,7 +85,7 @@
 
     def __getattr__(self, name):
         vars = self.__vars
-        if vars.has_key(name):
+        if name in vars:
             return vars[name]
         return getattr(self.__ob, name)
 
@@ -101,9 +101,9 @@
         localroles = _mergedLocalRoles(ob)
         for user, roles in localroles.items():
             for role in roles:
-                if allowed.has_key(role):
+                if role in allowed:
                     allowed['user:' + user] = 1
-        if allowed.has_key('Owner'):
+        if 'Owner' in allowed:
             del allowed['Owner']
         return list(allowed.keys())
 
@@ -130,11 +130,10 @@
 
     security = ClassSecurityInfo()
 
-    manage_options = ( ZCatalog.manage_options +
-                      ActionProviderBase.manage_options +
-                      ({ 'label' : 'Overview', 'action' : 'manage_overview' }
-                     ,
-                     ))
+    manage_options = (
+        ZCatalog.manage_options +
+        ActionProviderBase.manage_options +
+        ({'label': 'Overview', 'action': 'manage_overview'},))
 
     def __init__(self):
         ZCatalog.__init__(self, self.getId())
@@ -143,7 +142,7 @@
     #   ZMI methods
     #
     security.declareProtected(ManagePortal, 'manage_overview')
-    manage_overview = DTMLFile( 'explainCatalogTool', _dtmldir )
+    manage_overview = DTMLFile('explainCatalogTool', _dtmldir)
 
     #
     #   'portal_catalog' interface methods
@@ -157,20 +156,20 @@
             proxy_roles = getattr(eo, '_proxy_roles', None)
             if proxy_roles:
                 effective_roles = proxy_roles
-        result = list( effective_roles )
-        result.append( 'Anonymous' )
-        result.append( 'user:%s' % user.getId() )
+        result = list(effective_roles)
+        result.append('Anonymous')
+        result.append('user:%s' % user.getId())
         return result
 
     def _convertQuery(self, kw):
         # Convert query to modern syntax
         for k in 'effective', 'expires':
-            kusage = k+'_usage'
-            if not kw.has_key(kusage):
+            kusage = k + '_usage'
+            if not kusage in kw:
                 continue
             usage = kw[kusage]
             if not usage.startswith('range:'):
-                raise ValueError("Incorrect usage %s" % `usage`)
+                raise ValueError("Incorrect usage %s" % repr(usage))
             kw[k] = {'query': kw[k], 'range': usage[6:]}
             del kw[kusage]
 
@@ -181,16 +180,16 @@
             limit the results to what the user is allowed to see.
         """
         user = getSecurityManager().getUser()
-        kw[ 'allowedRolesAndUsers' ] = self._listAllowedRolesAndUsers( user )
+        kw['allowedRolesAndUsers'] = self._listAllowedRolesAndUsers(user)
 
-        if not _checkPermission( AccessInactivePortalContent, self ):
+        if not _checkPermission(AccessInactivePortalContent, self):
             now = DateTime()
 
             self._convertQuery(kw)
 
             # Intersect query restrictions with those implicit to the tool
             for k in 'effective', 'expires':
-                if kw.has_key(k):
+                if k in kw:
                     range = kw[k]['range'] or ''
                     query = kw[k]['query']
                     if not isinstance(query, (tuple, list)):
@@ -248,9 +247,9 @@
         return ZCatalog.searchResults(self, REQUEST, **kw)
 
     def __url(self, ob):
-        return '/'.join( ob.getPhysicalPath() )
+        return '/'.join(ob.getPhysicalPath())
 
-    manage_catalogFind = DTMLFile( 'catalogFind', _dtmldir )
+    manage_catalogFind = DTMLFile('catalogFind', _dtmldir)
 
     def catalog_object(self, obj, uid=None, idxs=None, update_metadata=1,
                        pghandler=None):
@@ -259,7 +258,7 @@
         if IIndexableObject.providedBy(obj):
             w = obj
         else:
-            w = queryMultiAdapter( (obj, self), IIndexableObject )
+            w = queryMultiAdapter((obj, self), IIndexableObject)
             if w is None:
                 # BBB
                 w = IndexableObjectWrapper(obj, self)

Modified: Products.CMFCore/trunk/Products/CMFCore/ContentTypeRegistry.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/ContentTypeRegistry.py	2012-04-24 10:35:32 UTC (rev 125264)
+++ Products.CMFCore/trunk/Products/CMFCore/ContentTypeRegistry.py	2012-04-24 10:35:58 UTC (rev 125265)
@@ -34,7 +34,7 @@
 from Products.CMFCore.utils import registerToolInterface
 
 
-class MajorMinorPredicate( SimpleItem ):
+class MajorMinorPredicate(SimpleItem):
 
     """
         Predicate matching on 'major/minor' content types.
@@ -44,14 +44,14 @@
     implements(IContentTypeRegistryPredicate)
 
     major = minor = None
-    PREDICATE_TYPE  = 'major_minor'
+    PREDICATE_TYPE = 'major_minor'
 
     security = ClassSecurityInfo()
 
-    def __init__( self, id ):
+    def __init__(self, id):
         self.id = id
 
-    security.declareProtected( ManagePortal, 'getMajorType' )
+    security.declareProtected(ManagePortal, 'getMajorType')
     def getMajorType(self):
         """ Get major content types.
         """
@@ -59,7 +59,7 @@
             return 'None'
         return ' '.join(self.major)
 
-    security.declareProtected( ManagePortal, 'getMinorType' )
+    security.declareProtected(ManagePortal, 'getMinorType')
     def getMinorType(self):
         """ Get minor content types.
         """
@@ -67,18 +67,18 @@
             return 'None'
         return ' '.join(self.minor)
 
-    security.declareProtected( ManagePortal, 'edit' )
-    def edit( self, major, minor, COMMA_SPLIT=re.compile( r'[, ]' ) ):
+    security.declareProtected(ManagePortal, 'edit')
+    def edit(self, major, minor, COMMA_SPLIT=re.compile(r'[, ]')):
 
         if major == 'None':
             major = None
-        if type( major ) is type( '' ):
-            major = filter( None, COMMA_SPLIT.split( major ) )
+        if type(major) is type(''):
+            major = filter(None, COMMA_SPLIT.split(major))
 
         if minor == 'None':
             minor = None
-        if type( minor ) is type( '' ):
-            minor = filter( None, COMMA_SPLIT.split( minor ) )
+        if type(minor) is type(''):
+            minor = filter(None, COMMA_SPLIT.split(minor))
 
         self.major = major
         self.minor = minor
@@ -87,7 +87,7 @@
     #   ContentTypeRegistryPredicate interface
     #
     security.declareObjectPublic()
-    def __call__( self, name, typ, body ):
+    def __call__(self, name, typ, body):
         """
             Return true if the rule matches, else false.
         """
@@ -110,20 +110,20 @@
 
         return 1
 
-    security.declareProtected( ManagePortal, 'getTypeLabel' )
-    def getTypeLabel( self ):
+    security.declareProtected(ManagePortal, 'getTypeLabel')
+    def getTypeLabel(self):
         """
             Return a human-readable label for the predicate type.
         """
         return self.PREDICATE_TYPE
 
-    security.declareProtected( ManagePortal, 'predicateWidget' )
-    predicateWidget = DTMLFile( 'majorMinorWidget', _dtmldir )
+    security.declareProtected(ManagePortal, 'predicateWidget')
+    predicateWidget = DTMLFile('majorMinorWidget', _dtmldir)
 
-InitializeClass( MajorMinorPredicate )
+InitializeClass(MajorMinorPredicate)
 
 
-class ExtensionPredicate( SimpleItem ):
+class ExtensionPredicate(SimpleItem):
 
     """
         Predicate matching on filename extensions.
@@ -132,14 +132,14 @@
     implements(IContentTypeRegistryPredicate)
 
     extensions = None
-    PREDICATE_TYPE  = 'extension'
+    PREDICATE_TYPE = 'extension'
 
     security = ClassSecurityInfo()
 
-    def __init__( self, id ):
+    def __init__(self, id):
         self.id = id
 
-    security.declareProtected( ManagePortal, 'getExtensions' )
+    security.declareProtected(ManagePortal, 'getExtensions')
     def getExtensions(self):
         """ Get filename extensions.
         """
@@ -147,13 +147,13 @@
             return 'None'
         return ' '.join(self.extensions)
 
-    security.declareProtected( ManagePortal, 'edit' )
-    def edit( self, extensions, COMMA_SPLIT=re.compile( r'[, ]' ) ):
+    security.declareProtected(ManagePortal, 'edit')
+    def edit(self, extensions, COMMA_SPLIT=re.compile(r'[, ]')):
 
         if extensions == 'None':
             extensions = None
-        if type( extensions ) is type( '' ):
-            extensions = filter( None, COMMA_SPLIT.split( extensions ) )
+        if type(extensions) is type(''):
+            extensions = filter(None, COMMA_SPLIT.split(extensions))
 
         self.extensions = extensions
 
@@ -161,7 +161,7 @@
     #   ContentTypeRegistryPredicate interface
     #
     security.declareObjectPublic()
-    def __call__( self, name, typ, body ):
+    def __call__(self, name, typ, body):
         """
             Return true if the rule matches, else false.
         """
@@ -169,25 +169,25 @@
             return 0
 
         _base, ext = os.path.splitext(name)
-        if ext and ext[ 0 ] == '.':
-            ext = ext[ 1: ]
+        if ext and ext[0] == '.':
+            ext = ext[1:]
 
         return ext in self.extensions
 
-    security.declareProtected( ManagePortal, 'getTypeLabel' )
-    def getTypeLabel( self ):
+    security.declareProtected(ManagePortal, 'getTypeLabel')
+    def getTypeLabel(self):
         """
             Return a human-readable label for the predicate type.
         """
         return self.PREDICATE_TYPE
 
-    security.declareProtected( ManagePortal, 'predicateWidget' )
-    predicateWidget = DTMLFile( 'extensionWidget', _dtmldir )
+    security.declareProtected(ManagePortal, 'predicateWidget')
+    predicateWidget = DTMLFile('extensionWidget', _dtmldir)
 
-InitializeClass( ExtensionPredicate )
+InitializeClass(ExtensionPredicate)
 
 
-class MimeTypeRegexPredicate( SimpleItem ):
+class MimeTypeRegexPredicate(SimpleItem):
 
     """
         Predicate matching only on 'typ', using regex matching for
@@ -197,55 +197,55 @@
 
     implements(IContentTypeRegistryPredicate)
 
-    pattern         = None
-    PREDICATE_TYPE  = 'mimetype_regex'
+    pattern = None
+    PREDICATE_TYPE = 'mimetype_regex'
 
     security = ClassSecurityInfo()
 
-    def __init__( self, id ):
+    def __init__(self, id):
         self.id = id
 
-    security.declareProtected( ManagePortal, 'getPatternStr' )
-    def getPatternStr( self ):
+    security.declareProtected(ManagePortal, 'getPatternStr')
+    def getPatternStr(self):
         if self.pattern is None:
             return 'None'
         return self.pattern.pattern
 
-    security.declareProtected( ManagePortal, 'edit' )
-    def edit( self, pattern ):
+    security.declareProtected(ManagePortal, 'edit')
+    def edit(self, pattern):
         if pattern == 'None':
             pattern = None
-        if type( pattern ) is type( '' ):
-            pattern = re.compile( pattern )
+        if type(pattern) is type(''):
+            pattern = re.compile(pattern)
         self.pattern = pattern
 
     #
     #   ContentTypeRegistryPredicate interface
     #
     security.declareObjectPublic()
-    def __call__( self, name, typ, body ):
+    def __call__(self, name, typ, body):
         """
             Return true if the rule matches, else false.
         """
         if self.pattern is None:
             return 0
 
-        return self.pattern.match( typ )
+        return self.pattern.match(typ)
 
-    security.declareProtected( ManagePortal, 'getTypeLabel' )
-    def getTypeLabel( self ):
+    security.declareProtected(ManagePortal, 'getTypeLabel')
+    def getTypeLabel(self):
         """
             Return a human-readable label for the predicate type.
         """
         return self.PREDICATE_TYPE
 
-    security.declareProtected( ManagePortal, 'predicateWidget' )
-    predicateWidget = DTMLFile( 'patternWidget', _dtmldir )
+    security.declareProtected(ManagePortal, 'predicateWidget')
+    predicateWidget = DTMLFile('patternWidget', _dtmldir)
 
-InitializeClass( MimeTypeRegexPredicate )
+InitializeClass(MimeTypeRegexPredicate)
 
 
-class NameRegexPredicate( SimpleItem ):
+class NameRegexPredicate(SimpleItem):
 
     """
         Predicate matching only on 'name', using regex matching
@@ -255,16 +255,16 @@
 
     implements(IContentTypeRegistryPredicate)
 
-    pattern         = None
-    PREDICATE_TYPE  = 'name_regex'
+    pattern = None
+    PREDICATE_TYPE = 'name_regex'
 
     security = ClassSecurityInfo()
 
-    def __init__( self, id ):
+    def __init__(self, id):
         self.id = id
 
-    security.declareProtected( ManagePortal, 'getPatternStr' )
-    def getPatternStr( self ):
+    security.declareProtected(ManagePortal, 'getPatternStr')
+    def getPatternStr(self):
         """
             Return a string representation of our pattern.
         """
@@ -272,57 +272,54 @@
             return 'None'
         return self.pattern.pattern
 
-    security.declareProtected( ManagePortal, 'edit' )
-    def edit( self, pattern ):
+    security.declareProtected(ManagePortal, 'edit')
+    def edit(self, pattern):
         if pattern == 'None':
             pattern = None
-        if type( pattern ) is type( '' ):
-            pattern = re.compile( pattern )
+        if type(pattern) is type(''):
+            pattern = re.compile(pattern)
         self.pattern = pattern
 
     #
     #   ContentTypeRegistryPredicate interface
     #
     security.declareObjectPublic()
-    def __call__( self, name, typ, body ):
+    def __call__(self, name, typ, body):
         """
             Return true if the rule matches, else false.
         """
         if self.pattern is None:
             return 0
 
-        return self.pattern.match( name )
+        return self.pattern.match(name)
 
-    security.declareProtected( ManagePortal, 'getTypeLabel' )
-    def getTypeLabel( self ):
+    security.declareProtected(ManagePortal, 'getTypeLabel')
+    def getTypeLabel(self):
         """
             Return a human-readable label for the predicate type.
         """
         return self.PREDICATE_TYPE
 
-    security.declareProtected( ManagePortal, 'predicateWidget' )
-    predicateWidget = DTMLFile( 'patternWidget', _dtmldir )
+    security.declareProtected(ManagePortal, 'predicateWidget')
+    predicateWidget = DTMLFile('patternWidget', _dtmldir)
 
-InitializeClass( NameRegexPredicate )
+InitializeClass(NameRegexPredicate)
 
 
 _predicate_types = []
 
-def registerPredicateType( typeID, klass ):
+def registerPredicateType(typeID, klass):
     """
         Add a new predicate type.
     """
-    _predicate_types.append( ( typeID, klass ) )
+    _predicate_types.append((typeID, klass))
 
-for klass in ( MajorMinorPredicate
-             , ExtensionPredicate
-             , MimeTypeRegexPredicate
-             , NameRegexPredicate
-             ):
-    registerPredicateType( klass.PREDICATE_TYPE, klass )
+for klass in (MajorMinorPredicate, ExtensionPredicate, MimeTypeRegexPredicate,
+              NameRegexPredicate):
+    registerPredicateType(klass.PREDICATE_TYPE, klass)
 
 
-class ContentTypeRegistry( SimpleItem ):
+class ContentTypeRegistry(SimpleItem):
 
     """
         Registry for rules which map PUT args to a CMF Type Object.
@@ -333,98 +330,86 @@
     meta_type = 'Content Type Registry'
     id = 'content_type_registry'
 
-    manage_options = ( { 'label'    : 'Predicates'
-                       , 'action'   : 'manage_predicates'
-                       }
-                     , { 'label'    : 'Test'
-                       , 'action'   : 'manage_testRegistry'
-                       }
-                     ) + SimpleItem.manage_options
+    manage_options = (
+        ({'label': 'Predicates', 'action': 'manage_predicates'},
+         {'label': 'Test', 'action': 'manage_testRegistry'}) +
+        SimpleItem.manage_options)
 
     security = ClassSecurityInfo()
 
-    def __init__( self ):
-        self.predicate_ids  = ()
-        self.predicates     = PersistentMapping()
+    def __init__(self):
+        self.predicate_ids = ()
+        self.predicates = PersistentMapping()
 
     #
     #   ZMI
     #
-    security.declarePublic( 'listPredicateTypes' )
-    def listPredicateTypes( self ):
+    security.declarePublic('listPredicateTypes')
+    def listPredicateTypes(self):
         """
         """
-        return map( lambda x: x[0], _predicate_types )
+        return map(lambda x: x[0], _predicate_types)
 
-    security.declareProtected( ManagePortal, 'manage_predicates' )
-    manage_predicates = DTMLFile( 'registryPredList', _dtmldir )
+    security.declareProtected(ManagePortal, 'manage_predicates')
+    manage_predicates = DTMLFile('registryPredList', _dtmldir)
 
-    security.declareProtected( ManagePortal, 'doAddPredicate' )
-    def doAddPredicate( self, predicate_id, predicate_type, REQUEST ):
+    security.declareProtected(ManagePortal, 'doAddPredicate')
+    def doAddPredicate(self, predicate_id, predicate_type, REQUEST):
         """
         """
-        self.addPredicate( predicate_id, predicate_type )
-        REQUEST[ 'RESPONSE' ].redirect( self.absolute_url()
-                              + '/manage_predicates'
-                              + '?manage_tabs_message=Predicate+added.'
-                              )
+        self.addPredicate(predicate_id, predicate_type)
+        REQUEST['RESPONSE'].redirect(self.absolute_url()
+                                     + '/manage_predicates'
+                                     + '?manage_tabs_message=Predicate+added.')
 
-    security.declareProtected( ManagePortal, 'doUpdatePredicate' )
-    def doUpdatePredicate( self
-                         , predicate_id
-                         , predicate
-                         , typeObjectName
-                         , REQUEST
-                         ):
+    security.declareProtected(ManagePortal, 'doUpdatePredicate')
+    def doUpdatePredicate(self, predicate_id, predicate, typeObjectName,
+                          REQUEST):
         """
         """
-        self.updatePredicate( predicate_id, predicate, typeObjectName )
-        REQUEST[ 'RESPONSE' ].redirect( self.absolute_url()
-                              + '/manage_predicates'
-                              + '?manage_tabs_message=Predicate+updated.'
-                              )
+        self.updatePredicate(predicate_id, predicate, typeObjectName)
+        REQUEST['RESPONSE'].redirect(self.absolute_url()
+                                   + '/manage_predicates'
+                                   + '?manage_tabs_message=Predicate+updated.')
 
-    security.declareProtected( ManagePortal, 'doMovePredicateUp' )
-    def doMovePredicateUp( self, predicate_id, REQUEST ):
+    security.declareProtected(ManagePortal, 'doMovePredicateUp')
+    def doMovePredicateUp(self, predicate_id, REQUEST):
         """
         """
-        predicate_ids = list( self.predicate_ids )
-        ndx = predicate_ids.index( predicate_id )
+        predicate_ids = list(self.predicate_ids)
+        ndx = predicate_ids.index(predicate_id)
         if ndx == 0:
             msg = "Predicate+already+first."
         else:
-            self.reorderPredicate( predicate_id, ndx - 1 )
+            self.reorderPredicate(predicate_id, ndx - 1)
             msg = "Predicate+moved."
-        REQUEST[ 'RESPONSE' ].redirect( self.absolute_url()
-                              + '/manage_predicates'
-                              + '?manage_tabs_message=%s' % msg
-                              )
+        REQUEST['RESPONSE'].redirect(self.absolute_url()
+                                     + '/manage_predicates'
+                                     + '?manage_tabs_message=%s' % msg)
 
-    security.declareProtected( ManagePortal, 'doMovePredicateDown' )
-    def doMovePredicateDown( self, predicate_id, REQUEST ):
+    security.declareProtected(ManagePortal, 'doMovePredicateDown')
+    def doMovePredicateDown(self, predicate_id, REQUEST):
         """
         """
-        predicate_ids = list( self.predicate_ids )
-        ndx = predicate_ids.index( predicate_id )
-        if ndx == len( predicate_ids ) - 1:
+        predicate_ids = list(self.predicate_ids)
+        ndx = predicate_ids.index(predicate_id)
+        if ndx == len(predicate_ids) - 1:
             msg = "Predicate+already+last."
         else:
-            self.reorderPredicate( predicate_id, ndx + 1 )
+            self.reorderPredicate(predicate_id, ndx + 1)
             msg = "Predicate+moved."
-        REQUEST[ 'RESPONSE' ].redirect( self.absolute_url()
-                              + '/manage_predicates'
-                              + '?manage_tabs_message=%s' % msg
-                              )
+        REQUEST['RESPONSE'].redirect(self.absolute_url()
+                                     + '/manage_predicates'
+                                     + '?manage_tabs_message=%s' % msg)
 
-    security.declareProtected( ManagePortal, 'doRemovePredicate' )
-    def doRemovePredicate( self, predicate_id, REQUEST ):
+    security.declareProtected(ManagePortal, 'doRemovePredicate')
+    def doRemovePredicate(self, predicate_id, REQUEST):
         """
         """
-        self.removePredicate( predicate_id )
-        REQUEST[ 'RESPONSE' ].redirect( self.absolute_url()
-                              + '/manage_predicates'
-                              + '?manage_tabs_message=Predicate+removed.'
-                              )
+        self.removePredicate(predicate_id)
+        REQUEST['RESPONSE'].redirect(self.absolute_url()
+                                   + '/manage_predicates'
+                                   + '?manage_tabs_message=Predicate+removed.')
 
     security.declareProtected(ManagePortal, 'manage_testRegistry')
     manage_testRegistry = DTMLFile('registryTest', _dtmldir)
@@ -447,36 +432,36 @@
     #
     #   Predicate manipulation
     #
-    security.declarePublic( 'getPredicate' )
-    def getPredicate( self, predicate_id ):
+    security.declarePublic('getPredicate')
+    def getPredicate(self, predicate_id):
         """
             Find the predicate whose id is 'id';  return the predicate
             object, if found, or else None.
         """
-        return self.predicates.get( predicate_id, ( None, None ) )[0]
+        return self.predicates.get(predicate_id, (None, None))[0]
 
-    security.declarePublic( 'listPredicates' )
-    def listPredicates( self ):
+    security.declarePublic('listPredicates')
+    def listPredicates(self):
         """List '(id, (predicate, typeObjectName))' tuples for all predicates.
         """
         return tuple([ (id, self.predicates[id])
                        for id in self.predicate_ids ])
 
-    security.declarePublic( 'getTypeObjectName' )
-    def getTypeObjectName( self, predicate_id ):
+    security.declarePublic('getTypeObjectName')
+    def getTypeObjectName(self, predicate_id):
         """
             Find the predicate whose id is 'id';  return the name of
             the type object, if found, or else None.
         """
-        return self.predicates.get( predicate_id, ( None, None ) )[1]
+        return self.predicates.get(predicate_id, (None, None))[1]
 
-    security.declareProtected( ManagePortal, 'addPredicate' )
-    def addPredicate( self, predicate_id, predicate_type ):
+    security.declareProtected(ManagePortal, 'addPredicate')
+    def addPredicate(self, predicate_id, predicate_type):
         """
             Add a predicate to this element of type 'typ' to the registry.
         """
         if predicate_id in self.predicate_ids:
-            raise ValueError, "Existing predicate: %s" % predicate_id
+            raise ValueError("Existing predicate: %s" % predicate_id)
 
         klass = None
         for key, value in _predicate_types:
@@ -484,66 +469,66 @@
                 klass = value
 
         if klass is None:
-            raise ValueError, "Unknown predicate type: %s" % predicate_type
+            raise ValueError("Unknown predicate type: %s" % predicate_type)
 
-        self.predicates[ predicate_id ] = ( klass( predicate_id ), None )
-        self.predicate_ids = self.predicate_ids + ( predicate_id, )
+        self.predicates[predicate_id] = (klass(predicate_id), None)
+        self.predicate_ids = self.predicate_ids + (predicate_id,)
 
-    security.declareProtected( ManagePortal, 'updatePredicate' )
-    def updatePredicate( self, predicate_id, predicate, typeObjectName ):
+    security.declareProtected(ManagePortal, 'updatePredicate')
+    def updatePredicate(self, predicate_id, predicate, typeObjectName):
         """
             Update a predicate in this element.
         """
         if not predicate_id in self.predicate_ids:
-            raise ValueError, "Unknown predicate: %s" % predicate_id
+            raise ValueError("Unknown predicate: %s" % predicate_id)
 
-        predObj = self.predicates[ predicate_id ][0]
-        mapply( predObj.edit, (), predicate.__dict__ )
-        self.assignTypeName( predicate_id, typeObjectName )
+        predObj = self.predicates[predicate_id][0]
+        mapply(predObj.edit, (), predicate.__dict__)
+        self.assignTypeName(predicate_id, typeObjectName)
 
-    security.declareProtected( ManagePortal, 'removePredicate' )
-    def removePredicate( self, predicate_id ):
+    security.declareProtected(ManagePortal, 'removePredicate')
+    def removePredicate(self, predicate_id):
         """
             Remove a predicate from the registry.
         """
-        del self.predicates[ predicate_id ]
-        idlist = list( self.predicate_ids )
-        ndx = idlist.index( predicate_id )
-        idlist = idlist[ :ndx ] + idlist[ ndx+1: ]
-        self.predicate_ids = tuple( idlist )
+        del self.predicates[predicate_id]
+        idlist = list(self.predicate_ids)
+        ndx = idlist.index(predicate_id)
+        idlist = idlist[:ndx] + idlist[ndx + 1:]
+        self.predicate_ids = tuple(idlist)
 
-    security.declareProtected( ManagePortal, 'reorderPredicate' )
-    def reorderPredicate( self, predicate_id, newIndex ):
+    security.declareProtected(ManagePortal, 'reorderPredicate')
+    def reorderPredicate(self, predicate_id, newIndex):
         """
             Move a given predicate to a new location in the list.
         """
-        idlist = list( self.predicate_ids )
-        ndx = idlist.index( predicate_id )
-        pred = idlist[ ndx ]
-        idlist = idlist[ :ndx ] + idlist[ ndx+1: ]
-        idlist.insert( newIndex, pred )
-        self.predicate_ids = tuple( idlist )
+        idlist = list(self.predicate_ids)
+        ndx = idlist.index(predicate_id)
+        pred = idlist[ndx]
+        idlist = idlist[:ndx] + idlist[ndx + 1:]
+        idlist.insert(newIndex, pred)
+        self.predicate_ids = tuple(idlist)
 
-    security.declareProtected( ManagePortal, 'assignTypeName' )
-    def assignTypeName( self, predicate_id, typeObjectName ):
+    security.declareProtected(ManagePortal, 'assignTypeName')
+    def assignTypeName(self, predicate_id, typeObjectName):
         """
             Bind the given predicate to a particular type object.
         """
         pred, _oldTypeObjName = self.predicates[predicate_id]
-        self.predicates[ predicate_id ] = ( pred, typeObjectName )
+        self.predicates[predicate_id] = (pred, typeObjectName)
 
     #
     #   ContentTypeRegistry interface
     #
-    def findTypeName( self, name, typ, body ):
+    def findTypeName(self, name, typ, body):
         """
             Perform a lookup over a collection of rules, returning the
             the name of the Type object corresponding to name/typ/body.
             Return None if no match found.
         """
         for predicate_id in self.predicate_ids:
-            pred, typeObjectName = self.predicates[ predicate_id ]
-            if pred( name, typ, body ):
+            pred, typeObjectName = self.predicates[predicate_id]
+            if pred(name, typ, body):
                 return typeObjectName
 
         return None
@@ -552,17 +537,16 @@
 registerToolInterface('content_type_registry', IContentTypeRegistry)
 
 
-def manage_addRegistry( self, REQUEST=None ):
+def manage_addRegistry(self, REQUEST=None):
     """
         Add a CTR to self.
     """
     CTRID = ContentTypeRegistry.id
     reg = ContentTypeRegistry()
-    self._setObject( CTRID, reg )
-    reg = self._getOb( CTRID )
+    self._setObject(CTRID, reg)
+    reg = self._getOb(CTRID)
 
     if REQUEST is not None:
-        REQUEST[ 'RESPONSE' ].redirect( self.absolute_url()
-                              + '/manage_main'
-                              + '?manage_tabs_message=Registry+added.'
-                              )
+        REQUEST['RESPONSE'].redirect(self.absolute_url()
+                                     + '/manage_main'
+                                     + '?manage_tabs_message=Registry+added.')

Modified: Products.CMFCore/trunk/Products/CMFCore/CookieCrumbler.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/CookieCrumbler.py	2012-04-24 10:35:32 UTC (rev 125264)
+++ Products.CMFCore/trunk/Products/CMFCore/CookieCrumbler.py	2012-04-24 10:35:58 UTC (rev 125265)
@@ -1,14 +1,14 @@
 ##############################################################################
 #
 # Copyright (c) 2001 Zope Foundation and Contributors.
-# 
+#
 # 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.
-# 
+#
 ##############################################################################
 """ Cookie Crumbler: Enable cookies for non-cookie user folders.
 """
@@ -61,11 +61,11 @@
 
     implements(ICookieCrumbler)
     id = 'cookie_authentication'
-    
-    manage_options=(PropertyManager.manage_options
-                   + SimpleItem.manage_options
-                   )
 
+    manage_options = (
+        PropertyManager.manage_options +
+        SimpleItem.manage_options)
+
     meta_type = 'Cookie Crumbler'
 
     security = ClassSecurityInfo()
@@ -76,21 +76,20 @@
     # By default, anonymous users can view login/logout pages.
     _View_Permission = ('Anonymous',)
 
-
-    _properties = ({'id':'auth_cookie', 'type': 'string', 'mode':'w',
-                    'label':'Authentication cookie name'},
-                   {'id':'name_cookie', 'type': 'string', 'mode':'w',
-                    'label':'User name form variable'},
-                   {'id':'pw_cookie', 'type': 'string', 'mode':'w',
-                    'label':'User password form variable'},
-                   {'id':'persist_cookie', 'type': 'string', 'mode':'w',
-                    'label':'User name persistence form variable'},
-                   {'id':'local_cookie_path', 'type': 'boolean', 'mode':'w',
-                    'label':'Use cookie paths to limit scope'},
-                   {'id':'cache_header_value', 'type': 'string', 'mode':'w',
-                    'label':'Cache-Control header value'},
-                   {'id':'log_username', 'type':'boolean', 'mode': 'w',
-                    'label':'Log cookie auth username to access log'}
+    _properties = ({'id': 'auth_cookie', 'type': 'string', 'mode': 'w',
+                    'label': 'Authentication cookie name'},
+                   {'id': 'name_cookie', 'type': 'string', 'mode': 'w',
+                    'label': 'User name form variable'},
+                   {'id': 'pw_cookie', 'type': 'string', 'mode': 'w',
+                    'label': 'User password form variable'},
+                   {'id': 'persist_cookie', 'type': 'string', 'mode': 'w',
+                    'label': 'User name persistence form variable'},
+                   {'id': 'local_cookie_path', 'type': 'boolean', 'mode': 'w',
+                    'label': 'Use cookie paths to limit scope'},
+                   {'id': 'cache_header_value', 'type': 'string', 'mode': 'w',
+                    'label': 'Cache-Control header value'},
+                   {'id': 'log_username', 'type': 'boolean', 'mode': 'w',
+                    'label': 'Log cookie auth username to access log'}
                    )
 
     auth_cookie = '__ac'
@@ -105,21 +104,21 @@
     def delRequestVar(self, req, name):
         # No errors of any sort may propagate, and we don't care *what*
         # they are, even to log them.
-        try: 
+        try:
             del req.other[name]
-        except: 
+        except:
             pass
-        try: 
+        try:
             del req.form[name]
-        except: 
+        except:
             pass
-        try: 
+        try:
             del req.cookies[name]
-        except: 
+        except:
             pass
-        try: 
+        try:
             del req.environ[name]
-        except: 
+        except:
             pass
 
     security.declarePublic('getCookiePath')
@@ -150,7 +149,7 @@
     security.declarePrivate('defaultExpireAuthCookie')
     def defaultExpireAuthCookie(self, resp, cookie_name):
         resp.expireCookie(cookie_name, path=self.getCookiePath())
-    
+
     def _setAuthHeader(self, ac, request, response):
         """Set the auth headers for both the Zope and Medusa http request
         objects.
@@ -179,7 +178,7 @@
         """
         if (req.__class__ is not HTTPRequest
             or not req['REQUEST_METHOD'] in ('HEAD', 'GET', 'PUT', 'POST')
-            or req.environ.has_key('WEBDAV_SOURCE_PORT')):
+            or 'WEBDAV_SOURCE_PORT' in req.environ):
             raise CookieCrumblerDisabled
 
         # attempt may contain information about an earlier attempt to
@@ -193,7 +192,7 @@
                 # created it.  The user must be using basic auth.
                 raise CookieCrumblerDisabled
 
-            if req.has_key(self.pw_cookie) and req.has_key(self.name_cookie):
+            if self.pw_cookie in req and self.name_cookie in req:
                 # Attempt to log in and set cookies.
                 attempt = ATTEMPT_LOGIN
                 name = req[self.name_cookie]
@@ -210,13 +209,13 @@
                     # Expire the user name
                     resp.expireCookie(self.name_cookie,
                                       path=self.getCookiePath())
-                method = self.getCookieMethod( 'setAuthCookie'
-                                             , self.defaultSetAuthCookie )
-                method( resp, self.auth_cookie, quote( ac ) )
+                method = self.getCookieMethod('setAuthCookie',
+                                              self.defaultSetAuthCookie)
+                method(resp, self.auth_cookie, quote(ac))
                 self.delRequestVar(req, self.name_cookie)
                 self.delRequestVar(req, self.pw_cookie)
 
-            elif req.has_key(self.auth_cookie):
+            elif self.auth_cookie in req:
                 # Attempt to resume a session if the cookie is valid.
                 # Copy __ac to the auth header.
                 ac = unquote(req[self.auth_cookie])
@@ -238,7 +237,6 @@
         req._cookie_auth = attempt
         return attempt
 
-
     def __call__(self, container, req):
         '''The __before_publishing_traverse__ hook.'''
         resp = req['RESPONSE']

Modified: Products.CMFCore/trunk/Products/CMFCore/DiscussionTool.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/DiscussionTool.py	2012-04-24 10:35:32 UTC (rev 125264)
+++ Products.CMFCore/trunk/Products/CMFCore/DiscussionTool.py	2012-04-24 10:35:58 UTC (rev 125265)
@@ -48,7 +48,7 @@
 
     security = ClassSecurityInfo()
 
-    def __init__( self, content ):
+    def __init__(self, content):
         self.content = content
 
     security.declareProtected(ReplyToItem, 'createReply')
@@ -61,7 +61,7 @@
         location.addDiscussionItem(id, title, title, 'structured-text',
                                    text, self.content)
 
-        RESPONSE.redirect( self.absolute_url() + '/view' )
+        RESPONSE.redirect(self.absolute_url() + '/view')
 
     def getReplyLocationAndID(self, REQUEST):
         # It is not yet clear to me what the correct location for this hook is
@@ -77,10 +77,10 @@
 
         # Find an unused id in location
         id = int(DateTime().timeTime())
-        while hasattr(location, `id`):
+        while hasattr(location, repr(id)):
             id = id + 1
 
-        return location, `id`
+        return location, repr(id)
 
     security.declareProtected(View, 'getReplyResults')
     def getReplyResults(self):
@@ -92,8 +92,8 @@
         """
         ctool = queryUtility(ICatalogTool)
         if ctool is not None:
-            return ctool.searchResults(in_reply_to=
-                                      urllib.unquote('/'+self.absolute_url(1)))
+            return ctool.searchResults(in_reply_to=urllib.unquote(
+                                                   '/' + self.absolute_url(1)))
 
     security.declareProtected(View, 'getReplies')
     def getReplies(self):
@@ -129,15 +129,15 @@
 
     security = ClassSecurityInfo()
 
-    manage_options = ( { 'label' : 'Overview', 'action' : 'manage_overview' }
-                     ,
-                     ) + SimpleItem.manage_options
+    manage_options = (
+        ({'label': 'Overview', 'action': 'manage_overview'},) +
+        SimpleItem.manage_options)
 
     #
     #   ZMI methods
     #
     security.declareProtected(ManagePortal, 'manage_overview')
-    manage_overview = DTMLFile( 'explainDiscussionTool', _dtmldir )
+    manage_overview = DTMLFile('explainDiscussionTool', _dtmldir)
 
     #
     #   'portal_discussion' interface methods
@@ -146,7 +146,7 @@
     def getDiscussionFor(self, content):
         '''Gets the PortalDiscussion object that applies to content.
         '''
-        return OldDiscussable( content ).__of__( content )
+        return OldDiscussable(content).__of__(content)
 
     security.declarePublic('isDiscussionAllowedFor')
     def isDiscussionAllowedFor(self, content):
@@ -154,7 +154,7 @@
             Returns a boolean indicating whether a discussion is
             allowed for the specified content.
         '''
-        if hasattr( content, 'allow_discussion' ):
+        if hasattr(content, 'allow_discussion'):
             return content.allow_discussion
         typeInfo = content.getTypeInfo()
         if typeInfo:

Modified: Products.CMFCore/trunk/Products/CMFCore/FSDTMLMethod.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/FSDTMLMethod.py	2012-04-24 10:35:32 UTC (rev 125264)
+++ Products.CMFCore/trunk/Products/CMFCore/FSDTMLMethod.py	2012-04-24 10:35:58 UTC (rev 125265)
@@ -47,10 +47,10 @@
     _cache_namespace_keys = ()
     _reading = 0
 
-    manage_options=({'label':'Customize', 'action':'manage_main'},
-                    {'label':'View', 'action':''},
-                    {'label':'Proxy', 'action':'manage_proxyForm'},
-                   )
+    manage_options = (
+        {'label': 'Customize', 'action': 'manage_main'},
+        {'label': 'View', 'action': ''},
+        {'label': 'Proxy', 'action': 'manage_proxyForm'})
 
     security = ClassSecurityInfo()
     security.declareObjectProtected(View)
@@ -94,7 +94,7 @@
 
     #### The following is mainly taken from OFS/DTMLMethod.py ###
 
-    index_html=None # Prevent accidental acquisition
+    index_html = None # Prevent accidental acquisition
 
     # Documents masquerade as functions:
     func_code = DTMLMethod.func_code
@@ -107,8 +107,8 @@
 
         self._updateFromFS()
 
-        kw['document_id']   =self.getId()
-        kw['document_title']=self.title
+        kw['document_id'] = self.getId()
+        kw['document_title'] = self.title
 
         if client is not None:
             if _checkConditionalGET(self, kw):
@@ -121,15 +121,17 @@
                 return data
 
         __traceback_info__ = self._filepath
-        security=getSecurityManager()
+        security = getSecurityManager()
         security.addContext(self)
         try:
             r = HTML.__call__(self, client, REQUEST, **kw)
 
             if client is None:
                 # Called as subtemplate, so don't need error propagation!
-                if RESPONSE is None: result = r
-                else: result = decapitate(r, RESPONSE)
+                if RESPONSE is None:
+                    result = r
+                else:
+                    result = decapitate(r, RESPONSE)
                 if not self._cache_namespace_keys:
                     self.ZCacheable_set(result)
                 return result
@@ -139,14 +141,15 @@
                     self.ZCacheable_set(r)
                 return r
 
-        finally: security.removeContext(self)
+        finally:
+            security.removeContext(self)
 
-        have_key=RESPONSE.headers.has_key
-        if not (have_key('content-type') or have_key('Content-Type')):
-            if self.__dict__.has_key('content_type'):
-                c=self.content_type
+        headers = RESPONSE.headers
+        if not ('content-type' in headers or 'Content-Type' in headers):
+            if 'content_type' in self.__dict__:
+                c = self.content_type
             else:
-                c, e=guess_content_type(self.getId(), r)
+                c, _e = guess_content_type(self.getId(), r)
             RESPONSE.setHeader('Content-Type', c)
         if RESPONSE is not None:
             # caching policy manager hook

Modified: Products.CMFCore/trunk/Products/CMFCore/FSFile.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/FSFile.py	2012-04-24 10:35:32 UTC (rev 125264)
+++ Products.CMFCore/trunk/Products/CMFCore/FSFile.py	2012-04-24 10:35:58 UTC (rev 125265)
@@ -44,7 +44,7 @@
     meta_type = 'Filesystem File'
     content_type = 'unknown/unknown'
 
-    manage_options = ({'label':'Customize', 'action':'manage_main'},)
+    manage_options = ({'label': 'Customize', 'action': 'manage_main'},)
 
     security = ClassSecurityInfo()
     security.declareObjectProtected(View)
@@ -68,17 +68,17 @@
             return self.content_type
 
         # Next, look at file headers
-        headers=getattr(file, 'headers', None)
-        if headers and headers.has_key('content-type'):
-            content_type=headers['content-type']
+        headers = getattr(file, 'headers', None)
+        if headers and 'content-type' in headers:
+            content_type = headers['content-type']
         else:
             # Last resort: Use the (imperfect) content type guessing
             # mechanism from OFS.Image, which ultimately uses the
             # Python mimetypes module.
             if not isinstance(body, basestring):
                 body = body.data
-            content_type, enc=guess_content_type(
-                getattr(file, 'filename',id), body, content_type)
+            content_type, enc = guess_content_type(
+                getattr(file, 'filename', id), body, content_type)
             if (enc is None
                 and (content_type.startswith('text/') or
                      content_type.startswith('application/'))
@@ -104,14 +104,14 @@
             if mtime != self._file_mod_time or mtime == 0.0:
                 self.ZCacheable_invalidate()
                 self._file_mod_time = mtime
-            self.content_type=self._get_content_type(file, data, self.id)
+            self.content_type = self._get_content_type(file, data, self.id)
         return data
 
     #### The following is mainly taken from OFS/File.py ###
 
     def __str__(self):
         self._updateFromFS()
-        return str( self._readFile( 0 ) )
+        return str(self._readFile(0))
 
     def modified(self):
         return self.getModTime()

Modified: Products.CMFCore/trunk/Products/CMFCore/FSMetadata.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/FSMetadata.py	2012-04-24 10:35:32 UTC (rev 125264)
+++ Products.CMFCore/trunk/Products/CMFCore/FSMetadata.py	2012-04-24 10:35:58 UTC (rev 125265)
@@ -10,13 +10,12 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-""" Handles reading the properties for an object that comes from the filesystem.
+"""Handles reading the properties for an object that comes from the filesystem.
 """
 
 import logging
 from os.path import exists
 from ConfigParser import ConfigParser
-from warnings import warn
 
 import re
 
@@ -43,6 +42,7 @@
         """
         return optionstr.strip()
 
+
 class FSMetadata:
     # public API
     def __init__(self, filename):
@@ -115,8 +115,8 @@
         eg: 1:Manager or 0:Manager,Anonymous
         """
         if data.find(':') < 1:
-            raise ValueError, "The security declaration of file " + \
-                  "%r is in the wrong format" % self._filename
+            raise ValueError("The security declaration of file " +
+                             "%r is in the wrong format" % self._filename)
 
         acquire, roles = data.split(':')
         roles = [r.strip() for r in roles.split(',') if r.strip()]
@@ -142,4 +142,3 @@
         # we need to return None if we have none to be compatible
         # with existing API
         return None
-

Modified: Products.CMFCore/trunk/Products/CMFCore/FSObject.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/FSObject.py	2012-04-24 10:35:32 UTC (rev 125264)
+++ Products.CMFCore/trunk/Products/CMFCore/FSObject.py	2012-04-24 10:35:58 UTC (rev 125265)
@@ -108,8 +108,8 @@
             rop_info = self.rolesOfPermission(old_perm)
             roles = [x['name'] for x in rop_info if x['selected'] != '']
             try:
-                # if obj is based on OFS.ObjectManager an acquisition context is
-                # required for _subobject_permissions()
+                # if obj is based on OFS.ObjectManager an acquisition context
+                # is required for _subobject_permissions()
                 obj.__of__(parent).manage_permission(old_perm, roles=roles,
                                                      acquire=acquired)
             except ValueError:
@@ -131,8 +131,8 @@
             obj = folder._getOb(id)
             if RESPONSE is not None:
                 RESPONSE.redirect('%s/manage_main?manage_tabs_message=%s' % (
-                    obj.absolute_url(), html_quote("An object with this id already exists")
-                    ))
+                    obj.absolute_url(),
+                    html_quote("An object with this id already exists")))
         else:
             folder._verifyObjectPaste(obj, validate_src=0)
             folder._setObject(id, obj)
@@ -147,7 +147,7 @@
 
     def _createZODBClone(self):
         """Create a ZODB (editable) equivalent of this object."""
-        raise NotImplementedError, "This should be implemented in a subclass."
+        raise NotImplementedError("This should be implemented in a subclass.")
 
     def _readFile(self, reparse):
         """Read the data from the filesystem.
@@ -156,7 +156,7 @@
         data if necessary.  'reparse' is set when reading the second
         time and beyond.
         """
-        raise NotImplementedError, "This should be implemented in a subclass."
+        raise NotImplementedError("This should be implemented in a subclass.")
 
     # Refresh our contents from the filesystem if that is newer and we are
     # running in debug mode.
@@ -229,7 +229,7 @@
 <dtml-var manage_page_footer>
 """
 
-    manage_options = ({'label':'Error', 'action':'manage_showError'},)
+    manage_options = ({'label': 'Error', 'action': 'manage_showError'},)
 
     def __init__(self, id, filepath, exc_str='', fullname=None,
                  properties=None):

Modified: Products.CMFCore/trunk/Products/CMFCore/FSPageTemplate.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/FSPageTemplate.py	2012-04-24 10:35:32 UTC (rev 125264)
+++ Products.CMFCore/trunk/Products/CMFCore/FSPageTemplate.py	2012-04-24 10:35:58 UTC (rev 125265)
@@ -39,7 +39,8 @@
 
 
 xml_detect_re = re.compile('^\s*<\?xml\s+(?:[^>]*?encoding=["\']([^"\'>]+))?')
-charset_re = re.compile(r'charset.*?=.*?(?P<charset>[\w\-]*)', re.I|re.M|re.S)
+charset_re = re.compile(r'charset.*?=.*?(?P<charset>[\w\-]*)',
+                        re.I | re.M | re.S)
 _marker = object()
 
 
@@ -51,9 +52,9 @@
     meta_type = 'Filesystem Page Template'
     _owner = None  # Unowned
 
-    manage_options=({'label':'Customize', 'action':'manage_main'},
-                    {'label':'Test', 'action':'ZScriptHTML_tryForm'},
-                   )
+    manage_options = (
+        {'label': 'Customize', 'action': 'manage_main'},
+        {'label': 'Test', 'action': 'ZScriptHTML_tryForm'})
 
     security = ClassSecurityInfo()
     security.declareObjectProtected(View)
@@ -82,7 +83,8 @@
         """Read the data from the filesystem.
         """
         if reparse:
-            file = open(self._filepath, 'rU') # not 'rb', as this is a text file!
+            # not 'rb', as this is a text file!
+            file = open(self._filepath, 'rU')
             try:
                 data = file.read()
             finally:
@@ -117,7 +119,7 @@
 
                             if charset is None:
                                 charset = charsetFromMetaEquiv(data)
-                                
+
                         elif self.content_type.startswith('text/xml'):
                             charset = encodingFromXMLPreamble(data)
 
@@ -143,7 +145,6 @@
 
             self.write(data)
 
-
     security.declarePrivate('read')
     def read(self):
         # Tie in on an opportunity to auto-update
@@ -188,10 +189,10 @@
         """
         return 'file:%s' % self._filepath
 
-    security.declarePrivate( '_ZPT_exec' )
+    security.declarePrivate('_ZPT_exec')
     _ZPT_exec = ZopePageTemplate._exec.im_func
 
-    security.declarePrivate( '_exec' )
+    security.declarePrivate('_exec')
     def _exec(self, bound_names, args, kw):
         """Call a FSPageTemplate"""
         try:
@@ -201,18 +202,18 @@
         # Read file first to get a correct content_type default value.
         self._updateFromFS()
 
-        if not kw.has_key('args'):
+        if not 'args' in kw:
             kw['args'] = args
         bound_names['options'] = kw
 
         try:
             response = self.REQUEST.RESPONSE
-            if not response.headers.has_key('content-type'):
+            if not 'content-type' in response.headers:
                 response.setHeader('content-type', self.content_type)
         except AttributeError:
             pass
 
-        security=getSecurityManager()
+        security = getSecurityManager()
         bound_names['user'] = security.getUser()
 
         # Retrieve the value from the cache.
@@ -265,7 +266,7 @@
 
     source_dot_xml = Src()
 
-setattr(FSPageTemplate, 'source.xml',  FSPageTemplate.source_dot_xml)
+setattr(FSPageTemplate, 'source.xml', FSPageTemplate.source_dot_xml)
 setattr(FSPageTemplate, 'source.html', FSPageTemplate.source_dot_xml)
 InitializeClass(FSPageTemplate)
 

Modified: Products.CMFCore/trunk/Products/CMFCore/FSPythonScript.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/FSPythonScript.py	2012-04-24 10:35:32 UTC (rev 125264)
+++ Products.CMFCore/trunk/Products/CMFCore/FSPythonScript.py	2012-04-24 10:35:58 UTC (rev 125265)
@@ -52,22 +52,21 @@
     def getDiff(self):
         """ Return a diff of the current source with the original source.
         """
-        return unified_diff( self.original_source.splitlines()
-                           , self.read().splitlines()
-                           , 'original'
-                           , 'modified'
-                           , ''
-                           , ''
-                           , lineterm=""
-                           )
+        return unified_diff(self.original_source.splitlines(),
+                            self.read().splitlines(),
+                            'original',
+                            'modified',
+                            '',
+                            '',
+                            lineterm="")
 
     security.declareProtected(ViewManagementScreens, 'manage_showDiff')
     manage_showDiff = PageTemplateFile('www/cpsDiff.pt', globals())
 
-    manage_options = (PythonScript.manage_options[:1]
-                    + ({'label': 'Diff', 'action': 'manage_showDiff'},)
-                    + PythonScript.manage_options[1:]
-                     )
+    manage_options = (
+        PythonScript.manage_options[:1] +
+        ({'label': 'Diff', 'action': 'manage_showDiff'},) +
+        PythonScript.manage_options[1:])
 
 InitializeClass(CustomizedPythonScript)
 
@@ -82,10 +81,10 @@
     _proxy_roles = ()
     _owner = None  # Unowned
 
-    manage_options = ({'label':'Customize', 'action':'manage_main'},
-                      {'label':'Test', 'action':'ZScriptHTML_tryForm',
-                       'help': ('PythonScripts', 'PythonScript_test.stx')},
-                     )
+    manage_options = (
+        {'label': 'Customize', 'action': 'manage_main'},
+        {'label': 'Test', 'action': 'ZScriptHTML_tryForm',
+         'help': ('PythonScripts', 'PythonScript_test.stx')})
 
     security = ClassSecurityInfo()
     security.declareObjectProtected(View)
@@ -95,7 +94,7 @@
 
     security.declareProtected(View, 'index_html',)
     # Prevent the bindings from being edited TTW
-    security.declarePrivate('ZBindings_edit','ZBindingsHTML_editForm',
+    security.declarePrivate('ZBindings_edit', 'ZBindingsHTML_editForm',
                             'ZBindingsHTML_editAction')
 
     def _createZODBClone(self):
@@ -141,7 +140,7 @@
         for name in self._params.split(','):
             name = name.strip()
             if name and name[0] != '*':
-                param_names.append( name.split('=', 1)[0] )
+                param_names.append(name.split('=', 1)[0])
         return param_names
 
     security.declareProtected(ViewManagementScreens, 'read')
@@ -163,16 +162,19 @@
         return "%s\n%s" % (self._params, self._body)
 
     security.declareProtected(ViewManagementScreens, 'params')
-    def params(self): return self._params
+    def params(self):
+        return self._params
 
     security.declareProtected(ViewManagementScreens, 'manage_haveProxy')
     manage_haveProxy = PythonScript.manage_haveProxy.im_func
 
     security.declareProtected(ViewManagementScreens, 'body')
-    def body(self): return self._body
+    def body(self):
+        return self._body
 
     security.declareProtected(ViewManagementScreens, 'get_size')
-    def get_size(self): return len(self.read())
+    def get_size(self):
+        return len(self.read())
 
     security.declareProtected(FTPAccess, 'manage_FTPget')
     def manage_FTPget(self):

Modified: Products.CMFCore/trunk/Products/CMFCore/FSZSQLMethod.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/FSZSQLMethod.py	2012-04-24 10:35:32 UTC (rev 125264)
+++ Products.CMFCore/trunk/Products/CMFCore/FSZSQLMethod.py	2012-04-24 10:35:58 UTC (rev 125265)
@@ -39,10 +39,10 @@
 
     meta_type = 'Filesystem Z SQL Method'
 
-    manage_options = ({'label':'Customize', 'action':'manage_customise'},
-                      {'label':'Test', 'action':'manage_testForm',
-                       'help':('ZSQLMethods', 'Z-SQL-Method_Test.stx')},
-                     )
+    manage_options = (
+        {'label': 'Customize', 'action': 'manage_customise'},
+        {'label': 'Test', 'action': 'manage_testForm',
+         'help': ('ZSQLMethods', 'Z-SQL-Method_Test.stx')})
 
     security = ClassSecurityInfo()
     security.declareObjectProtected(View)
@@ -90,34 +90,34 @@
         # parse parameters
         parameters = {}
         start = data.find('<dtml-comment>')
-        end   = data.find('</dtml-comment>')
-        if start==-1 or end==-1 or start>end:
-            raise ValueError,'Could not find parameter block'
-        block = data[start+14:end]
+        end = data.find('</dtml-comment>')
+        if start == -1 or end == -1 or start > end:
+            raise ValueError('Could not find parameter block')
+        block = data[start + 14:end]
 
         for line in block.split('\n'):
-            pair = line.split(':',1)
-            if len(pair)!=2:
+            pair = line.split(':', 1)
+            if len(pair) != 2:
                 continue
-            parameters[pair[0].strip().lower()]=pair[1].strip()
+            parameters[pair[0].strip().lower()] = pair[1].strip()
 
         # check for required parameters
         try:
-            connection_id =   ( parameters.get('connection id', '') or
-                                parameters['connection_id'] )
-        except KeyError,e:
+            connection_id = (parameters.get('connection id', '') or
+                                parameters['connection_id'])
+        except KeyError, e:
             raise ValueError("The '%s' parameter is required "
                              "but was not supplied" % e)
 
         # Optional parameters
-        title =           parameters.get('title','')
-        arguments =       parameters.get('arguments','')
-        max_rows =        parameters.get('max_rows',1000)
-        max_cache =       parameters.get('max_cache',100)
-        cache_time =      parameters.get('cache_time',0)
-        class_name =      parameters.get('class_name','')
-        class_file =      parameters.get('class_file','')
-        connection_hook = parameters.get('connection_hook',None)
+        title = parameters.get('title', '')
+        arguments = parameters.get('arguments', '')
+        max_rows = parameters.get('max_rows', 1000)
+        max_cache = parameters.get('max_cache', 100)
+        cache_time = parameters.get('cache_time', 0)
+        class_name = parameters.get('class_name', '')
+        class_file = parameters.get('class_file', '')
+        connection_hook = parameters.get('connection_hook', None)
         direct = parameters.get('allow_simple_one_argument_traversal', None)
 
         self.manage_edit(title, connection_id, arguments, template=data)

Modified: Products.CMFCore/trunk/Products/CMFCore/MemberDataTool.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/MemberDataTool.py	2012-04-24 10:35:32 UTC (rev 125264)
+++ Products.CMFCore/trunk/Products/CMFCore/MemberDataTool.py	2012-04-24 10:35:58 UTC (rev 125265)
@@ -73,24 +73,21 @@
 
     security = ClassSecurityInfo()
 
-    manage_options=( ({'label': 'Overview',
-                       'action': 'manage_overview'},
-                      {'label': 'Contents',
-                       'action': 'manage_showContents'})
-                   + PropertyManager.manage_options
-                   + SimpleItem.manage_options
-                   )
+    manage_options = (
+        ({'label': 'Overview', 'action': 'manage_overview'},
+         {'label': 'Contents', 'action': 'manage_showContents'}) +
+        PropertyManager.manage_options +
+        SimpleItem.manage_options)
 
     #
     #   ZMI methods
     #
     security.declareProtected(ManagePortal, 'manage_overview')
-    manage_overview = DTMLFile( 'explainMemberDataTool', _dtmldir )
+    manage_overview = DTMLFile('explainMemberDataTool', _dtmldir)
 
     security.declareProtected(ViewManagementScreens, 'manage_showContents')
-    manage_showContents = DTMLFile('memberdataContents', _dtmldir )
+    manage_showContents = DTMLFile('memberdataContents', _dtmldir)
 
-
     def __init__(self):
         self._members = OOBTree()
 
@@ -114,8 +111,8 @@
             if member not in user_list:
                 orphan_count = orphan_count + 1
 
-        return [{ 'member_count' : member_count,
-                  'orphan_count' : orphan_count }]
+        return [{'member_count': member_count,
+                 'orphan_count': orphan_count}]
 
     security.declarePrivate('searchMemberData')
     def searchMemberData(self, search_param, search_term, attributes=()):
@@ -153,8 +150,8 @@
 
         return res
 
-    security.declarePrivate( 'searchMemberDataContents' )
-    def searchMemberDataContents( self, search_param, search_term ):
+    security.declarePrivate('searchMemberDataContents')
+    def searchMemberDataContents(self, search_param, search_term):
         """ Search members. This method will be deprecated soon. """
         res = []
 
@@ -165,18 +162,16 @@
 
         for member_id in self._members.keys():
 
-            user_wrapper = mtool.getMemberById( member_id )
+            user_wrapper = mtool.getMemberById(member_id)
 
             if user_wrapper is not None:
                 memberProperty = user_wrapper.getProperty
-                searched = memberProperty( search_param, None )
+                searched = memberProperty(search_param, None)
 
                 if searched is not None and searched.find(search_term) != -1:
 
-                    res.append( { 'username': memberProperty( 'id' )
-                                , 'email' : memberProperty( 'email', '' )
-                                }
-                            )
+                    res.append({'username': memberProperty('id'),
+                                'email': memberProperty('email', '')})
         return res
 
     security.declarePrivate('pruneMemberDataContents')
@@ -210,7 +205,7 @@
         """ Delete member data of specified member.
         """
         members = self._members
-        if members.has_key(member_id):
+        if member_id in members:
             del members[member_id]
             return 1
         else:
@@ -281,12 +276,12 @@
         # Sets the properties given in the MemberDataTool.
         tool = self._tool
         for id in tool.propertyIds():
-            if mapping.has_key(id):
-                if not self._md.__class__.__dict__.has_key(id):
+            if id in mapping:
+                if not id in self._md.__class__.__dict__:
                     value = mapping[id]
                     if isinstance(value, str):
                         proptype = tool.getPropertyType(id) or 'string'
-                        if type_converters.has_key(proptype):
+                        if proptype in type_converters:
                             value = type_converters[proptype](value)
                     setattr(self._md, id, value)
         # Hopefully we can later make notifyModified() implicit.
@@ -310,7 +305,7 @@
             elif default is not _marker:
                 return default
             else:
-                raise ValueError, 'The property %s does not exist' % id
+                raise ValueError('The property %s does not exist' % id)
 
         # If the tool has an empty property and we have a user_value, use it
         if not tool_value and user_value is not _marker:

Modified: Products.CMFCore/trunk/Products/CMFCore/MembershipTool.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/MembershipTool.py	2012-04-24 10:35:32 UTC (rev 125264)
+++ Products.CMFCore/trunk/Products/CMFCore/MembershipTool.py	2012-04-24 10:35:58 UTC (rev 125265)
@@ -73,25 +73,22 @@
 
     security = ClassSecurityInfo()
 
-    manage_options=( ({ 'label' : 'Configuration'
-                     , 'action' : 'manage_mapRoles'
-                     },) +
-                   ( { 'label' : 'Overview'
-                     , 'action' : 'manage_overview'
-                     },
-                   ) + Folder.manage_options)
+    manage_options = (
+        ({'label': 'Configuration', 'action': 'manage_mapRoles'},
+         {'label': 'Overview', 'action': 'manage_overview'}) +
+        Folder.manage_options)
 
     #
     #   ZMI methods
     #
     security.declareProtected(ManagePortal, 'manage_overview')
-    manage_overview = DTMLFile( 'explainMembershipTool', _dtmldir )
+    manage_overview = DTMLFile('explainMembershipTool', _dtmldir)
 
     #
     #   'portal_membership' interface methods
     #
     security.declareProtected(ManagePortal, 'manage_mapRoles')
-    manage_mapRoles = DTMLFile('membershipRolemapping', _dtmldir )
+    manage_mapRoles = DTMLFile('membershipRolemapping', _dtmldir)
 
     security.declareProtected(SetOwnPassword, 'setPassword')
     @postonly
@@ -163,7 +160,7 @@
         by the portal object
         """
         parent = self.aq_inner.aq_parent
-        roles = list( parent.userdefined_roles() )
+        roles = list(parent.userdefined_roles())
 
         # This is *not* a local role in the portal but used by it
         roles.append('Manager')
@@ -178,7 +175,8 @@
         set the mapping of roles between roles understood by
         the portal and roles coming from outside user sources
         """
-        if not hasattr(self, 'role_map'): self.role_map = PersistentMapping()
+        if not hasattr(self, 'role_map'):
+            self.role_map = PersistentMapping()
 
         if len(userfolder_role) < 1:
             del self.role_map[portal_role]
@@ -186,9 +184,9 @@
             self.role_map[portal_role] = userfolder_role
 
         return MessageDialog(
-               title  ='Mapping updated',
+               title='Mapping updated',
                message='The Role mappings have been updated',
-               action ='manage_mapRoles')
+               action='manage_mapRoles')
 
     security.declareProtected(ManagePortal, 'getMappedRole')
     def getMappedRole(self, portal_role):
@@ -239,9 +237,9 @@
             self.memberareaCreationFlag = 0
 
         return MessageDialog(
-               title  ='Member area creation flag changed',
+               title='Member area creation flag changed',
                message='Member area creation flag has been updated',
-               action ='manage_mapRoles')
+               action='manage_mapRoles')
 
     security.declarePublic('createMemberArea')
     def createMemberArea(self, member_id=''):
@@ -263,17 +261,17 @@
         else:
             member = self.getAuthenticatedMember()
             member_id = member.getId()
-        if hasattr( aq_base(members), member_id ):
+        if hasattr(aq_base(members), member_id):
             return None
         else:
             f_title = "%s's Home" % member_id
-            members.manage_addPortalFolder( id=member_id, title=f_title )
-            f=getattr(members, member_id)
+            members.manage_addPortalFolder(id=member_id, title=f_title)
+            f = getattr(members, member_id)
 
             f.manage_permission(View,
-                                ['Owner','Manager','Reviewer'], 0)
+                                ['Owner', 'Manager', 'Reviewer'], 0)
             f.manage_permission(AccessContentsInformation,
-                                ['Owner','Manager','Reviewer'], 0)
+                                ['Owner', 'Manager', 'Reviewer'], 0)
 
             # Grant Ownership and Owner role to Member
             f.changeOwnership(member)
@@ -292,7 +290,7 @@
         members = self.getMembersFolder()
         if not members:
             return 0
-        if hasattr( aq_base(members), member_id ):
+        if hasattr(aq_base(members), member_id):
             members.manage_delObjects(member_id)
             return 1
         else:
@@ -432,14 +430,14 @@
                       REQUEST=None):
         """ Add local roles on an item.
         """
-        if ( _checkPermission(ChangeLocalRoles, obj)
-             and member_role in self.getCandidateLocalRoles(obj) ):
+        if (_checkPermission(ChangeLocalRoles, obj)
+            and member_role in self.getCandidateLocalRoles(obj)):
             for member_id in member_ids:
-                roles = list(obj.get_local_roles_for_userid( userid=member_id ))
+                roles = list(obj.get_local_roles_for_userid(userid=member_id))
 
                 if member_role not in roles:
-                    roles.append( member_role )
-                    obj.manage_setLocalRoles( member_id, roles )
+                    roles.append(member_role)
+                    obj.manage_setLocalRoles(member_id, roles)
 
         if reindex and hasattr(aq_base(obj), 'reindexObjectSecurity'):
             obj.reindexObjectSecurity()
@@ -456,7 +454,7 @@
                     obj.manage_delLocalRoles(userids=member_ids)
                     break
 
-        if recursive and hasattr( aq_base(obj), 'contentValues' ):
+        if recursive and hasattr(aq_base(obj), 'contentValues'):
             for subobj in obj.contentValues():
                 self.deleteLocalRoles(subobj, member_ids, 0, 1)
 
@@ -512,8 +510,8 @@
 
         # Delete members' local roles.
         if delete_localroles:
-            self.deleteLocalRoles( getUtility(ISiteRoot), member_ids,
-                                   reindex=1, recursive=1 )
+            self.deleteLocalRoles(getUtility(ISiteRoot), member_ids,
+                                  reindex=1, recursive=1)
 
         return tuple(member_ids)
 

Modified: Products.CMFCore/trunk/Products/CMFCore/Skinnable.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/Skinnable.py	2012-04-24 10:35:32 UTC (rev 125264)
+++ Products.CMFCore/trunk/Products/CMFCore/Skinnable.py	2012-04-24 10:35:58 UTC (rev 125265)
@@ -27,12 +27,11 @@
 
 logger = logging.getLogger('CMFCore.Skinnable')
 
-
 _MARKER = object()  # Create a new marker object.
 
-
 SKINDATA = {} # mapping thread-id -> (skinobj, skinname, ignore, resolve)
 
+
 class SkinDataCleanup:
     """Cleanup at the end of the request."""
     def __init__(self, tid):
@@ -41,7 +40,7 @@
         tid = self.tid
         # Be extra careful in __del__
         if SKINDATA is not None:
-            if SKINDATA.has_key(tid):
+            if tid in SKINDATA:
                 del SKINDATA[tid]
 
 
@@ -66,7 +65,7 @@
         if name[0] not in ('_', '@', '+') and not name.startswith('aq_'):
             sd = SKINDATA.get(get_ident())
             if sd is not None:
-                ob, skinname, ignore, resolve = sd
+                ob, _skinname, ignore, resolve = sd
                 if not name in ignore:
                     if name in resolve:
                         return resolve[name]
@@ -131,7 +130,7 @@
         '''
         sd = SKINDATA.get(get_ident())
         if sd is not None:
-            ob, skinname, ignore, resolve = sd
+            _ob, skinname, _ignore, _resolve = sd
             if skinname is not None:
                 return skinname
         # nothing here, so assume the default skin
@@ -147,7 +146,7 @@
     def clearCurrentSkin(self):
         """Clear the current skin."""
         tid = get_ident()
-        if SKINDATA.has_key(tid):
+        if tid in SKINDATA:
             del SKINDATA[tid]
 
     security.declarePublic('setupCurrentSkin')
@@ -160,7 +159,7 @@
         '''
         if REQUEST is None:
             return
-        if SKINDATA.has_key(get_ident()):
+        if get_ident() in SKINDATA:
             # Already set up for this request.
             return
         skinname = self.getSkinNameFromRequest(REQUEST)
@@ -190,7 +189,7 @@
             if sd is not None:
                 del SKINDATA[tid]
             try:
-                base = getattr(self,  'aq_base', self)
+                base = getattr(self, 'aq_base', self)
                 if not hasattr(base, id):
                     # Cause _checkId to not check for duplication.
                     return superCheckId(self, id, allow_dup=1)

Modified: Products.CMFCore/trunk/Products/CMFCore/TypesTool.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/TypesTool.py	2012-04-24 10:35:32 UTC (rev 125264)
+++ Products.CMFCore/trunk/Products/CMFCore/TypesTool.py	2012-04-24 10:35:58 UTC (rev 125265)
@@ -68,12 +68,11 @@
 
     implements(IAction)
 
-    manage_options = ( SimpleItemWithProperties.manage_options[:1]
-                     + ( {'label':'Aliases',
-                          'action':'manage_aliases'}, )
-                     + ActionProviderBase.manage_options
-                     + SimpleItemWithProperties.manage_options[1:]
-                     )
+    manage_options = (
+        SimpleItemWithProperties.manage_options[:1] +
+        ({'label': 'Aliases', 'action': 'manage_aliases'},) +
+        ActionProviderBase.manage_options +
+        SimpleItemWithProperties.manage_options[1:])
 
     security = ClassSecurityInfo()
 
@@ -82,16 +81,16 @@
     security.declareProtected(ManagePortal, 'manage_propertiesForm')
 
     _basic_properties = (
-        {'id':'title', 'type': 'string', 'mode':'w',
-         'label':'Title'},
-        {'id':'description', 'type': 'text', 'mode':'w',
-         'label':'Description'},
-        {'id':'i18n_domain', 'type': 'string', 'mode':'w',
-         'label':'I18n Domain'},
+        {'id': 'title', 'type': 'string', 'mode': 'w',
+         'label': 'Title'},
+        {'id': 'description', 'type': 'text', 'mode': 'w',
+         'label': 'Description'},
+        {'id': 'i18n_domain', 'type': 'string', 'mode': 'w',
+         'label': 'I18n Domain'},
         {'id': 'icon_expr', 'type': 'string', 'mode': 'w',
          'label': 'Icon (Expression)'},
-        {'id':'content_meta_type', 'type': 'string', 'mode':'w',
-         'label':'Product meta type'},
+        {'id': 'content_meta_type', 'type': 'string', 'mode': 'w',
+         'label': 'Product meta type'},
         )
 
     _advanced_properties = (
@@ -99,22 +98,17 @@
          'label': 'Add view URL (Expression)'},
         {'id': 'link_target', 'type': 'string', 'mode': 'w',
          'label': 'Add view link target'},
-        {'id':'immediate_view', 'type': 'string', 'mode':'w',
-         'label':'Initial view name'},
-        {'id':'global_allow', 'type': 'boolean', 'mode':'w',
-         'label':'Implicitly addable?'},
-        {'id':'filter_content_types', 'type': 'boolean', 'mode':'w',
-         'label':'Filter content types?'},
-        {'id':'allowed_content_types'
-         , 'type': 'multiple selection'
-         , 'mode':'w'
-         , 'label':'Allowed content types'
-         , 'select_variable':'listContentTypes'
-         },
-        { 'id': 'allow_discussion', 'type': 'boolean', 'mode': 'w'
-          , 'label': 'Allow Discussion?'
-          },
-        )
+        {'id': 'immediate_view', 'type': 'string', 'mode': 'w',
+         'label': 'Initial view name'},
+        {'id': 'global_allow', 'type': 'boolean', 'mode': 'w',
+         'label': 'Implicitly addable?'},
+        {'id': 'filter_content_types', 'type': 'boolean', 'mode': 'w',
+         'label': 'Filter content types?'},
+        {'id': 'allowed_content_types', 'type': 'multiple selection',
+         'mode': 'w', 'label': 'Allowed content types',
+         'select_variable': 'listContentTypes'},
+        {'id': 'allow_discussion', 'type': 'boolean', 'mode': 'w',
+         'label': 'Allow Discussion?'})
 
     title = ''
     description = ''
@@ -140,8 +134,8 @@
 
         kw = kw.copy()  # Get a modifiable dict.
 
-        if (not kw.has_key('content_meta_type')
-            and kw.has_key('meta_type')):
+        if (not 'content_meta_type' in kw
+            and 'meta_type' in kw):
             kw['content_meta_type'] = kw['meta_type']
 
         if 'content_icon' in kw or 'icon' in kw:
@@ -153,28 +147,28 @@
                      DeprecationWarning, stacklevel=2)
             else:
                 warn('TypeInformation got a deprecated argument content_icon.'
-                     'Support for the content_icon argument will be removed in '
-                     'CMF 2.4. Please use the icon_expr argument instead.',
+                     'Support for the content_icon argument will be removed '
+                     'in CMF 2.4. Please use the icon_expr argument instead.',
                      DeprecationWarning, stacklevel=2)
 
             if 'icon_expr' not in kw:
-                kw['icon_expr'] = 'string:${portal_url}/%s' % kw['content_icon']
+                kw['icon_expr'] = ('string:${portal_url}/%s'
+                                   % kw['content_icon'])
 
         self.manage_changeProperties(**kw)
 
-        actions = kw.get( 'actions', () )
+        actions = kw.get('actions', ())
         for action in actions:
             self.addAction(
-                  id=action['id']
-                , name=action['title']
-                , action=action['action']
-                , condition=action.get('condition')
-                , permission=action.get( 'permissions', () )
-                , category=action.get('category', 'object')
-                , visible=action.get('visible', True)
-                , icon_expr=action.get('icon_expr', '')
-                , link_target=action.get('link_target', '')
-                )
+                id=action['id'],
+                name=action['title'],
+                action=action['action'],
+                condition=action.get('condition'),
+                permission=action.get('permissions', ()),
+                category=action.get('category', 'object'),
+                visible=action.get('visible', True),
+                icon_expr=action.get('icon_expr', ''),
+                link_target=action.get('link_target', ''))
 
         self.setMethodAliases(kw.get('aliases', {}))
 
@@ -182,7 +176,7 @@
     #   ZMI methods
     #
     security.declareProtected(ManagePortal, 'manage_aliases')
-    manage_aliases = PageTemplateFile( 'typeinfoAliases.zpt', _wwwdir )
+    manage_aliases = PageTemplateFile('typeinfoAliases.zpt', _wwwdir)
 
     security.declareProtected(ManagePortal, 'manage_setMethodAliases')
     def manage_setMethodAliases(self, REQUEST):
@@ -197,8 +191,8 @@
 
         _dict = {}
         for k, v in form['methods'].items():
-            if aliases.has_key(k):
-                _dict[ aliases[k] ] = v
+            if k in aliases:
+                _dict[aliases[k]] = v
         self.setMethodAliases(_dict)
         REQUEST.RESPONSE.redirect('%s/manage_aliases' % self.absolute_url())
 
@@ -257,13 +251,13 @@
         return getattr(self, 'icon_expr_object', None)
 
     security.declarePublic('allowType')
-    def allowType( self, contentType ):
+    def allowType(self, contentType):
         """
             Can objects of 'contentType' be added to containers whose
             type object we are?
         """
         if not self.filter_content_types:
-            ti = self.getTypeInfo( contentType )
+            ti = self.getTypeInfo(contentType)
             if ti is None or ti.globalAllow():
                 return 1
 
@@ -281,7 +275,7 @@
         return self.id
 
     security.declarePublic('allowDiscussion')
-    def allowDiscussion( self ):
+    def allowDiscussion(self):
         """
             Can this type of object support discussion?
         """
@@ -332,7 +326,7 @@
         for k, v in aliases.items():
             v = v.strip()
             if v:
-                _dict[ k.strip() ] = v
+                _dict[k.strip()] = v
         if not getattr(self, '_aliases', None) == _dict:
             self._aliases = _dict
             return True
@@ -349,7 +343,7 @@
         if isinstance(method_id, tuple):
             method_id = method_id[0]
         return method_id
-    
+
     security.declarePrivate('_checkWorkflowAllowed')
     def _checkWorkflowAllowed(self, container):
         """ Check if a workflow veto object creation
@@ -440,12 +434,12 @@
 
     security = ClassSecurityInfo()
 
-    _properties = (TypeInformation._basic_properties + (
-        {'id':'product', 'type': 'string', 'mode':'w',
-         'label':'Product name'},
-        {'id':'factory', 'type': 'string', 'mode':'w',
-         'label':'Product factory'},
-        ) + TypeInformation._advanced_properties)
+    _properties = (TypeInformation._basic_properties +
+                   ({'id': 'product', 'type': 'string', 'mode': 'w',
+                     'label': 'Product name'},
+                    {'id': 'factory', 'type': 'string', 'mode': 'w',
+                     'label': 'Product factory'}) +
+                   TypeInformation._advanced_properties)
 
     product = ''
     factory = ''
@@ -455,18 +449,18 @@
     #
     def _getFactoryMethod(self, container, check_security=1):
         if not self.product or not self.factory:
-            raise ValueError, ('Product factory for %s was undefined' %
-                               self.getId())
+            raise ValueError('Product factory for %s was undefined' %
+                             self.getId())
         p = container.manage_addProduct[self.product]
         m = getattr(p, self.factory, None)
         if m is None:
-            raise ValueError, ('Product factory for %s was invalid' %
-                               self.getId())
+            raise ValueError('Product factory for %s was invalid' %
+                             self.getId())
         if not check_security:
             return m
         if getSecurityManager().validate(p, p, self.factory, m):
             return m
-        raise AccessControl_Unauthorized( 'Cannot create %s' % self.getId() )
+        raise AccessControl_Unauthorized('Cannot create %s' % self.getId())
 
     def _queryFactoryMethod(self, container, default=None):
 
@@ -507,7 +501,7 @@
 
         c. Does the current user have the permission required in
         order to invoke the factory method?
-        
+
         d. Do all workflows authorize the creation?
         """
         ti_check = False
@@ -530,7 +524,7 @@
 
         if not ti_check:
             return False
-        else :
+        else:
             return self._checkWorkflowAllowed(container)
 
     security.declarePrivate('_constructInstance')
@@ -587,12 +581,12 @@
 
     security = ClassSecurityInfo()
 
-    _properties = (TypeInformation._basic_properties + (
-        {'id':'permission', 'type': 'string', 'mode':'w',
-         'label':'Constructor permission'},
-        {'id':'constructor_path', 'type': 'string', 'mode':'w',
-         'label':'Constructor path'},
-        ) + TypeInformation._advanced_properties)
+    _properties = (TypeInformation._basic_properties +
+                   ({'id': 'permission', 'type': 'string', 'mode': 'w',
+                     'label': 'Constructor permission'},
+                    {'id': 'constructor_path', 'type': 'string', 'mode': 'w',
+                     'label': 'Constructor path'}) +
+                   TypeInformation._advanced_properties)
 
     permission = ''
     constructor_path = ''
@@ -607,7 +601,7 @@
         order to construct an instance?
         """
         permission = self.permission
-        if permission and not _checkPermission( permission, container ):
+        if permission and not _checkPermission(permission, container):
             return 0
         return self._checkWorkflowAllowed(container)
 
@@ -617,13 +611,13 @@
 
         Does not do any security checks.
         """
-        constructor = self.restrictedTraverse( self.constructor_path )
+        constructor = self.restrictedTraverse(self.constructor_path)
 
         # make sure ownership is explicit before switching the context
-        if not hasattr( aq_base(constructor), '_owner' ):
+        if not hasattr(aq_base(constructor), '_owner'):
             constructor._owner = aq_get(constructor, '_owner')
         #   Rewrap to get into container's context.
-        constructor = aq_base(constructor).__of__( container )
+        constructor = aq_base(constructor).__of__(container)
 
         id = str(id)
         obj = constructor(container, id, *args, **kw)
@@ -659,23 +653,21 @@
 
     security = ClassSecurityInfo()
 
-    manage_options = ( OrderedFolder.manage_options[:1]
-                     + ( {'label':'Aliases',
-                          'action':'manage_aliases'}, )
-                     + ActionProviderBase.manage_options
-                     + ( {'label':'Overview',
-                          'action':'manage_overview'}, )
-                     + OrderedFolder.manage_options[1:]
-                     )
+    manage_options = (
+        OrderedFolder.manage_options[:1] +
+        ({'label': 'Aliases', 'action': 'manage_aliases'},) +
+        ActionProviderBase.manage_options +
+        ({'label': 'Overview', 'action': 'manage_overview'},) +
+        OrderedFolder.manage_options[1:])
 
     #
     #   ZMI methods
     #
     security.declareProtected(ManagePortal, 'manage_overview')
-    manage_overview = DTMLFile( 'explainTypesTool', _dtmldir )
+    manage_overview = DTMLFile('explainTypesTool', _dtmldir)
 
     security.declareProtected(ManagePortal, 'manage_aliases')
-    manage_aliases = PageTemplateFile( 'typesAliases.zpt', _wwwdir )
+    manage_aliases = PageTemplateFile('typesAliases.zpt', _wwwdir)
 
     #
     #   ObjectManager methods
@@ -706,8 +698,8 @@
                 klass = mt['instance']
                 break
         else:
-            raise ValueError, (
-                'Meta type %s is not a type class.' % add_meta_type)
+            raise ValueError('Meta type %s is not a type class.'
+                             % add_meta_type)
         id = str(id)
         ob = klass(id)
         self._setObject(id, ob)
@@ -727,14 +719,14 @@
 
         for ti in self.listTypeInfo():
             _dict = {}
-            for k, v in form[ ti.getId() ].items():
-                if aliases.has_key(k):
-                    _dict[ aliases[k] ] = v
+            for k, v in form[ti.getId()].items():
+                if k in aliases:
+                    _dict[aliases[k]] = v
             ti.setMethodAliases(_dict)
         REQUEST.RESPONSE.redirect('%s/manage_aliases' % self.absolute_url())
 
     security.declareProtected(AccessContentsInformation, 'getTypeInfo')
-    def getTypeInfo( self, contentType ):
+    def getTypeInfo(self, contentType):
         """
             Return an instance which implements the
             TypeInformation interface, corresponding to
@@ -749,14 +741,14 @@
                     return None
             else:
                 return None
-        ob = getattr( self, contentType, None )
+        ob = getattr(self, contentType, None)
         if ITypeInformation.providedBy(ob):
             return ob
         else:
             return None
 
     security.declareProtected(AccessContentsInformation, 'listTypeInfo')
-    def listTypeInfo( self, container=None ):
+    def listTypeInfo(self, container=None):
         """
             Return a sequence of instances which implement the
             TypeInformation interface, one for each content
@@ -784,7 +776,7 @@
         removed when CMFCore/dtml/catalogFind.dtml doesn't need it anymore.
         """
         typenames = {}
-        for t in self.listTypeInfo( container ):
+        for t in self.listTypeInfo(container):
 
             if by_metatype:
                 warn('TypeInformation.listContentTypes(by_metatype=1) is '
@@ -795,39 +787,33 @@
                 name = t.getId()
 
             if name:
-                typenames[ name ] = None
+                typenames[name] = None
 
         result = typenames.keys()
         result.sort()
         return result
 
     security.declarePublic('constructContent')
-    def constructContent( self
-                        , type_name
-                        , container
-                        , id
-                        , RESPONSE=None
-                        , *args
-                        , **kw
-                        ):
+    def constructContent(self, type_name, container, id, RESPONSE=None, *args,
+                         **kw):
         """
             Build an instance of the appropriate content class in
             'container', using 'id'.
         """
-        info = self.getTypeInfo( type_name )
+        info = self.getTypeInfo(type_name)
         if info is None:
             raise ValueError('No such content type: %s' % type_name)
 
         ob = info.constructInstance(container, id, *args, **kw)
 
         if RESPONSE is not None:
-            immediate_url = '%s/%s' % ( ob.absolute_url()
-                                      , info.immediate_view )
-            RESPONSE.redirect( immediate_url )
+            immediate_url = '%s/%s' % (ob.absolute_url(),
+                                       info.immediate_view)
+            RESPONSE.redirect(immediate_url)
 
         return ob.getId()
 
-    security.declarePrivate( 'listActions' )
+    security.declarePrivate('listActions')
     def listActions(self, info=None, object=None):
         """ List all the actions defined by a provider.
         """
@@ -843,7 +829,7 @@
         if object is not None:
             type_info = self.getTypeInfo(object)
             if type_info is not None:
-                actions.extend( type_info.listActions(info, object) )
+                actions.extend(type_info.listActions(info, object))
 
         add_actions = [ ti for ti in self.objectValues()
                         if IAction.providedBy(ti) ]

Modified: Products.CMFCore/trunk/Products/CMFCore/WorkflowTool.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/WorkflowTool.py	2012-04-24 10:35:32 UTC (rev 125264)
+++ Products.CMFCore/trunk/Products/CMFCore/WorkflowTool.py	2012-04-24 10:35:58 UTC (rev 125265)
@@ -73,21 +73,20 @@
 
     security = ClassSecurityInfo()
 
-    manage_options = ( { 'label' : 'Workflows'
-                       , 'action' : 'manage_selectWorkflows'
-                       }
-                     , { 'label' : 'Overview', 'action' : 'manage_overview' }
-                     ) + Folder.manage_options
+    manage_options = (
+        ({'label': 'Workflows', 'action': 'manage_selectWorkflows'},
+         {'label': 'Overview', 'action': 'manage_overview'}) +
+        Folder.manage_options)
 
     #
     #   ZMI methods
     #
-    security.declareProtected( ManagePortal, 'manage_overview' )
-    manage_overview = DTMLFile( 'explainWorkflowTool', _dtmldir )
+    security.declareProtected(ManagePortal, 'manage_overview')
+    manage_overview = DTMLFile('explainWorkflowTool', _dtmldir)
 
     _manage_selectWorkflows = DTMLFile('selectWorkflows', _dtmldir)
 
-    security.declareProtected( ManagePortal, 'manage_selectWorkflows')
+    security.declareProtected(ManagePortal, 'manage_selectWorkflows')
     def manage_selectWorkflows(self, REQUEST, manage_tabs_message=None):
 
         """ Show a management screen for changing type to workflow connections.
@@ -100,7 +99,7 @@
             title = t.Title()
             if title == id:
                 title = None
-            if cbt is not None and cbt.has_key(id):
+            if cbt is not None and id in cbt:
                 chain = ', '.join(cbt[id])
             else:
                 chain = '(Default)'
@@ -114,7 +113,7 @@
             management_view='Workflows',
             manage_tabs_message=manage_tabs_message)
 
-    security.declareProtected( ManagePortal, 'manage_changeWorkflows')
+    security.declareProtected(ManagePortal, 'manage_changeWorkflows')
     @postonly
     def manage_changeWorkflows(self, default_chain, props=None, REQUEST=None):
         """ Changes which workflows apply to objects of which type.
@@ -133,7 +132,7 @@
                 chain = props.get(field_name, '(Default)').strip()
                 if chain == '(Default)':
                     # Remove from cbt.
-                    if cbt.has_key(id):
+                    if id in cbt:
                         del cbt[id]
                 else:
                     chain = chain.replace(',', ' ')
@@ -141,8 +140,8 @@
                     for wf_id in chain.split(' '):
                         if wf_id:
                             if not self.getWorkflowById(wf_id):
-                                raise ValueError, (
-                                    '"%s" is not a workflow ID.' % wf_id)
+                                raise ValueError('"%s" is not a workflow ID.'
+                                                 % wf_id)
                             ids.append(wf_id)
                     cbt[id] = tuple(ids)
         # Set up the default chain.
@@ -151,13 +150,12 @@
         for wf_id in default_chain.split(' '):
             if wf_id:
                 if not self.getWorkflowById(wf_id):
-                    raise ValueError, (
-                        '"%s" is not a workflow ID.' % wf_id)
+                    raise ValueError('"%s" is not a workflow ID.' % wf_id)
                 ids.append(wf_id)
         self._default_chain = tuple(ids)
         if REQUEST is not None:
             return self.manage_selectWorkflows(REQUEST,
-                            manage_tabs_message='Changed.')
+                                               manage_tabs_message='Changed.')
 
     #
     #   'IActionProvider' interface methods
@@ -195,7 +193,7 @@
 
         wf_ids = self.getWorkflowIds()
         for wf_id in wf_ids:
-            if not did.has_key(wf_id):
+            if not wf_id in did:
                 wf = self.getWorkflowById(wf_id)
                 if wf is not None:
                     a = wf.listGlobalActions(info)
@@ -386,7 +384,7 @@
 
         if chain is None:
             for type_id in pt_names:
-                if cbt.has_key(type_id):
+                if type_id in cbt:
                     del cbt[type_id]
             return
 
@@ -450,8 +448,8 @@
         portal = aq_parent(aq_inner(self))
         count = self._recursiveUpdateRoleMappings(portal, wfs)
         if REQUEST is not None:
-            return self.manage_selectWorkflows(REQUEST, manage_tabs_message=
-                                               '%d object(s) updated.' % count)
+            return self.manage_selectWorkflows(REQUEST,
+                           manage_tabs_message='%d object(s) updated.' % count)
         else:
             return count
 
@@ -508,7 +506,7 @@
             return ttool.listTypeInfo()
         return ()
 
-    security.declarePrivate( '_invokeWithNotification' )
+    security.declarePrivate('_invokeWithNotification')
     def _invokeWithNotification(self, wfs, ob, action, func, args, kw):
 
         """ Private utility method:  call 'func', and deal with exceptions
@@ -542,7 +540,7 @@
             self._reindexWorkflowVariables(ob)
         return res
 
-    security.declarePrivate( '_recursiveUpdateRoleMappings' )
+    security.declarePrivate('_recursiveUpdateRoleMappings')
     def _recursiveUpdateRoleMappings(self, ob, wfs):
         """ Update roles-permission mappings recursively, and
             reindex special index.
@@ -578,8 +576,8 @@
                         v._p_deactivate()
         return count
 
-    security.declarePrivate( '_setDefaultCataloging' )
-    def _setDefaultCataloging( self, value ):
+    security.declarePrivate('_setDefaultCataloging')
+    def _setDefaultCataloging(self, value):
 
         """ Toggle whether '_reindexWorkflowVariables' actually touches
             the catalog (sometimes not desirable, e.g. when the workflow

Modified: Products.CMFCore/trunk/Products/CMFCore/tests/base/testcase.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/tests/base/testcase.py	2012-04-24 10:35:32 UTC (rev 125264)
+++ Products.CMFCore/trunk/Products/CMFCore/tests/base/testcase.py	2012-04-24 10:35:58 UTC (rev 125265)
@@ -41,7 +41,7 @@
     def _catch_log_errors(self, ignored_level=logging.WARNING, subsystem=''):
 
         if subsystem in self.installed:
-            raise ValueError, 'Already installed filter!'
+            raise ValueError('Already installed filter!')
 
         root_logger = logging.getLogger(subsystem)
         self.installed += (subsystem,)
@@ -245,7 +245,8 @@
 
     def setUp(self):
         # store the place where the skin copy will be created
-        self.tempname = mktemp(dir=getPackageLocation('Products.CMFCore.tests'))
+        self.tempname = mktemp(dir=getPackageLocation(
+                                                     'Products.CMFCore.tests'))
         # create the temporary folder
         mkdir(self.tempname)
         # copy the source fake skin to the new location

Modified: Products.CMFCore/trunk/Products/CMFCore/tests/test_MemberDataTool.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/tests/test_MemberDataTool.py	2012-04-24 10:35:32 UTC (rev 125264)
+++ Products.CMFCore/trunk/Products/CMFCore/tests/test_MemberDataTool.py	2012-04-24 10:35:58 UTC (rev 125265)
@@ -88,9 +88,9 @@
     def test_deleteMemberData(self):
         tool = self._makeOne()
         tool.registerMemberData('Dummy', 'user_foo')
-        self.assertTrue(tool._members.has_key('user_foo'))
+        self.assertTrue('user_foo' in tool._members)
         self.assertTrue(tool.deleteMemberData('user_foo'))
-        self.assertFalse(tool._members.has_key('user_foo'))
+        self.assertFalse('user_foo' in tool._members)
         self.assertFalse(tool.deleteMemberData('user_foo'))
 
     def test_pruneMemberData(self):

Modified: Products.CMFCore/trunk/Products/CMFCore/utils.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/utils.py	2012-04-24 10:35:32 UTC (rev 125264)
+++ Products.CMFCore/trunk/Products/CMFCore/utils.py	2012-04-24 10:35:58 UTC (rev 125265)
@@ -56,11 +56,11 @@
 
 SUBTEMPLATE = '__SUBTEMPLATE__'
 
-security = ModuleSecurityInfo( 'Products.CMFCore.utils' )
+security = ModuleSecurityInfo('Products.CMFCore.utils')
 
 _globals = globals()
-_dtmldir = os_path.join( package_home( globals() ), 'dtml' )
-_wwwdir = os_path.join( package_home( globals() ), 'www' )
+_dtmldir = os_path.join(package_home(globals()), 'dtml')
+_wwwdir = os_path.join(package_home(globals()), 'www')
 
 #
 #   Simple utility functions, callable from restricted code.
@@ -100,8 +100,8 @@
         try:
             utility = getUtility(tool_interface)
             # Site managers, except for five.localsitemanager, return unwrapped
-            # utilities. If the result is something which is acquisition-unaware
-            # but unwrapped we wrap it on the context.
+            # utilities. If the result is something which is
+            # acquisition-unaware but unwrapped we wrap it on the context.
             if IAcquirer.providedBy(obj) and \
                     aq_parent(utility) is None and \
                     IAcquirer.providedBy(utility):
@@ -120,7 +120,7 @@
         return default
     else:
         if tool is _marker:
-            raise AttributeError, name
+            raise AttributeError(name)
         return tool
 
 security.declarePublic('getUtilityByInterfaceName')
@@ -134,7 +134,7 @@
         iface = resolve_dotted_name(dotted_name)
     except ImportError:
         if default is _marker:
-            raise ComponentLookupError, dotted_name
+            raise ComponentLookupError(dotted_name)
         return default
 
     try:
@@ -154,11 +154,11 @@
     o Lowercase the ID.
     """
     rgx = re.compile(r'(^_|[^a-zA-Z0-9-_~\,\.])')
-    cooked = re.sub(rgx, "",text).lower()
+    cooked = re.sub(rgx, "", text).lower()
     return cooked
 
 security.declarePublic('tuplize')
-def tuplize( valueName, value ):
+def tuplize(valueName, value):
 
     """ Make a tuple from 'value'.
 
@@ -167,10 +167,10 @@
     if isinstance(value, tuple):
         return value
     if isinstance(value, list):
-        return tuple( value )
+        return tuple(value)
     if isinstance(value, basestring):
-        return tuple( value.split() )
-    raise ValueError, "%s of unsupported type" % valueName
+        return tuple(value.split())
+    raise ValueError("%s of unsupported type" % valueName)
 
 #
 #   Security utilities, callable only from unrestricted code.
@@ -212,19 +212,20 @@
     while 1:
         if hasattr(object, '__ac_local_roles__'):
             dict = object.__ac_local_roles__ or {}
-            if callable(dict): dict = dict()
+            if callable(dict):
+                dict = dict()
             for k, v in dict.items():
-                if merged.has_key(k):
+                if k in merged:
                     merged[k] = merged[k] + v
                 else:
                     merged[k] = v
         if hasattr(object, 'aq_parent'):
-            object=object.aq_parent
-            object=getattr(object, 'aq_inner', object)
+            object = object.aq_parent
+            object = getattr(object, 'aq_inner', object)
             continue
         if hasattr(object, 'im_self'):
-            object=object.im_self
-            object=getattr(object, 'aq_inner', object)
+            object = object.im_self
+            object = getattr(object, 'aq_inner', object)
             continue
         break
 
@@ -237,14 +238,15 @@
     # an empty tuple as the second.
     d = {}
     perms = getattr(ob, '__ac_permissions__', ())
-    for p in perms: d[p[0]] = None
+    for p in perms:
+        d[p[0]] = None
     r = gather_permissions(ob.__class__, [], d)
     if all:
         if hasattr(ob, '_subobject_permissions'):
             for p in ob._subobject_permissions():
-                pname=p[0]
-                if not d.has_key(pname):
-                    d[pname]=1
+                pname = p[0]
+                if not pname in d:
+                    d[pname] = 1
                     r.append(p)
         r = list(perms) + r
     return r
@@ -303,18 +305,18 @@
 
 # Parse a string of etags from an If-None-Match header
 # Code follows ZPublisher.HTTPRequest.parse_cookie
-parse_etags_lock=allocate_lock()
-def parse_etags( text
-               , result=None
+parse_etags_lock = allocate_lock()
+def parse_etags(text,
+                result=None,
                 # quoted etags (assumed separated by whitespace + a comma)
-               , etagre_quote = re.compile('(\s*\"([^\"]*)\"\s*,{0,1})')
+                etagre_quote=re.compile('(\s*\"([^\"]*)\"\s*,{0,1})'),
                 # non-quoted etags (assumed separated by whitespace + a comma)
-               , etagre_noquote = re.compile('(\s*([^,]*)\s*,{0,1})')
-               , acquire=parse_etags_lock.acquire
-               , release=parse_etags_lock.release
-               ):
+                etagre_noquote=re.compile('(\s*([^,]*)\s*,{0,1})'),
+                acquire=parse_etags_lock.acquire,
+                release=parse_etags_lock.release):
 
-    if result is None: result=[]
+    if result is None:
+        result = []
     if not len(text):
         return result
 
@@ -323,13 +325,13 @@
         m = etagre_quote.match(text)
         if m:
             # Match quoted etag (spec-observing client)
-            l     = len(m.group(1))
+            l = len(m.group(1))
             value = m.group(2)
         else:
             # Match non-quoted etag (lazy client)
             m = etagre_noquote.match(text)
             if m:
-                l     = len(m.group(1))
+                l = len(m.group(1))
                 value = m.group(2)
             else:
                 return result
@@ -338,7 +340,7 @@
 
     if value:
         result.append(value)
-    return apply(parse_etags,(text[l:],result))
+    return apply(parse_etags, (text[l:], result))
 
 def _checkConditionalGET(obj, extra_context):
     """A conditional GET is done using one or both of the request
@@ -368,7 +370,7 @@
 
     # check whether we need to suppress subtemplates
     call_count = getattr(REQUEST, SUBTEMPLATE, 0)
-    setattr(REQUEST, SUBTEMPLATE, call_count+1)
+    setattr(REQUEST, SUBTEMPLATE, call_count + 1)
     if call_count != 0:
         return False
 
@@ -417,19 +419,19 @@
         return False
 
     if if_modified_since:
-        if ( not content_mod_time or 
-             mod_time_secs < 0 or 
-             mod_time_secs > if_modified_since ):
+        if (not content_mod_time or
+            mod_time_secs < 0 or
+            mod_time_secs > if_modified_since):
             return False
 
     if client_etags:
-        if ( not content_etag or 
-             (content_etag not in client_etags and '*' not in client_etags) ):
+        if (not content_etag or
+            (content_etag not in client_etags and '*' not in client_etags)):
             return False
     else:
-        # If we generate an ETag, don't validate the conditional GET unless 
+        # If we generate an ETag, don't validate the conditional GET unless
         # the client supplies an ETag
-        # This may be more conservative than the spec requires, but we are 
+        # This may be more conservative than the spec requires, but we are
         # already _way_ more conservative.
         if content_etag:
             return False
@@ -505,7 +507,7 @@
                              % self.getId())
 
 
-class UniqueObject (ImmutableId):
+class UniqueObject(ImmutableId):
 
     """ Base class for objects which cannot be "overridden" / shadowed.
     """
@@ -515,16 +517,15 @@
     __replaceable__ = property(_getUNIQUE,)
 
 
-class SimpleItemWithProperties (PropertyManager, SimpleItem):
+class SimpleItemWithProperties(PropertyManager, SimpleItem):
     """
     A common base class for objects with configurable
     properties in a fixed schema.
     """
     manage_options = (
-        PropertyManager.manage_options
-        + SimpleItem.manage_options)
+        PropertyManager.manage_options +
+        SimpleItem.manage_options)
 
-
     security = ClassSecurityInfo()
     security.declarePrivate('manage_addProperty')
     security.declarePrivate('manage_delProperties')
@@ -538,7 +539,7 @@
         form = PropertyManager.manage_propertiesForm.__of__(self)
         return form(self, REQUEST, *args, **my_kw)
 
-InitializeClass( SimpleItemWithProperties )
+InitializeClass(SimpleItemWithProperties)
 
 
 #
@@ -566,15 +567,12 @@
         productObject = context._ProductContext__prod
         self.product_name = productObject.id
         context.registerClass(
-            meta_type = self.meta_type,
+            meta_type=self.meta_type,
             # This is a little sneaky: we add self to the
             # FactoryDispatcher under the name "toolinit".
             # manage_addTool() can then grab it.
-            constructors = (manage_addToolForm,
-                            manage_addTool,
-                            self,),
-            icon = self.icon
-            )
+            constructors=(manage_addToolForm, manage_addTool, self),
+            icon=self.icon)
 
         if self.icon:
             icon = os_path.split(self.icon)[1]
@@ -584,7 +582,7 @@
             tool.__factory_meta_type__ = self.meta_type
             tool.icon = 'misc_/%s/%s' % (self.product_name, icon)
 
-InitializeClass( ToolInit )
+InitializeClass(ToolInit)
 
 addInstanceForm = HTMLFile('dtml/addInstance', globals())
 
@@ -635,14 +633,8 @@
     security = ClassSecurityInfo()
     security.declareObjectPrivate()
 
-    def __init__( self
-                , meta_type
-                , content_types
-                , permission=None
-                , extra_constructors=()
-                , fti=()
-                , visibility='Global'
-                ):
+    def __init__(self, meta_type, content_types, permission=None,
+                 extra_constructors=(), fti=(), visibility='Global'):
         # BBB: fti argument is ignored
         self.meta_type = meta_type
         self.content_types = content_types
@@ -653,24 +645,21 @@
     def initialize(self, context):
         # Add only one meta type to the folder add list.
         context.registerClass(
-            meta_type = self.meta_type
+            meta_type=self.meta_type,
             # This is a little sneaky: we add self to the
             # FactoryDispatcher under the name "contentinit".
             # manage_addContentType() can then grab it.
-            , constructors = ( manage_addContentForm
-                               , manage_addContent
-                               , self ) + self.extra_constructors
-            , permission = self.permission
-            , visibility = self.visibility
-            )
+            constructors=(manage_addContentForm, manage_addContent,
+                          self) + self.extra_constructors,
+            permission=self.permission,
+            visibility=self.visibility)
 
         for ct in self.content_types:
             ct.__factory_meta_type__ = self.meta_type
 
-InitializeClass( ContentInit )
+InitializeClass(ContentInit)
 
 def manage_addContentForm(self, REQUEST):
-
     """ Show the add content type form.
     """
     # self is a FactoryDispatcher.
@@ -685,8 +674,7 @@
                            factory_types_list=tl,
                            factory_need_id=1)
 
-def manage_addContent( self, id, type, REQUEST=None ):
-
+def manage_addContent(self, id, type, REQUEST=None):
     """ Add the content type specified by name.
     """
     # self is a FactoryDispatcher.
@@ -694,11 +682,11 @@
     obj = None
     for content_type in contentinit.content_types:
         if content_type.meta_type == type:
-            obj = content_type( id )
+            obj = content_type(id)
             break
     if obj is None:
         raise NotFound(type)
-    self._setObject( id, obj )
+    self._setObject(id, obj)
     if REQUEST is not None:
         return self.manage_main(self, REQUEST)
 
@@ -715,10 +703,10 @@
     name = os_path.split(iconspec)[1]
     klass.icon = 'misc_/%s/%s' % (pid, name)
     icon = ImageFile(iconspec, _prefix)
-    icon.__roles__=None
+    icon.__roles__ = None
     if not hasattr(misc_images, pid):
         setattr(misc_images, pid, MiscImage(pid, {}))
-    getattr(misc_images, pid)[name]=icon
+    getattr(misc_images, pid)[name] = icon
 
 #
 #   Metadata Keyword splitter utilities
@@ -726,17 +714,15 @@
 KEYSPLITRE = re.compile(r'[,;]')
 
 security.declarePublic('keywordsplitter')
-def keywordsplitter( headers
-                   , names=('Subject', 'Keywords',)
-                   , splitter=KEYSPLITRE.split
-                   ):
+def keywordsplitter(headers, names=('Subject', 'Keywords',),
+                    splitter=KEYSPLITRE.split):
     """ Split keywords out of headers, keyed on names.  Returns list.
     """
     out = []
     for head in names:
         keylist = splitter(headers.get(head, ''))
         keylist = map(lambda x: x.strip(), keylist)
-        out.extend( [key for key in keylist if key] )
+        out.extend([ key for key in keylist if key ])
     return out
 
 #
@@ -745,13 +731,11 @@
 CONTRIBSPLITRE = re.compile(r';')
 
 security.declarePublic('contributorsplitter')
-def contributorsplitter( headers
-                       , names=('Contributors',)
-                       , splitter=CONTRIBSPLITRE.split
-                       ):
+def contributorsplitter(headers, names=('Contributors',),
+                        splitter=CONTRIBSPLITRE.split):
     """ Split contributors out of headers, keyed on names.  Returns list.
     """
-    return keywordsplitter( headers, names, splitter )
+    return keywordsplitter(headers, names, splitter)
 
 #
 #   Directory-handling utilities
@@ -760,7 +744,7 @@
 def normalize(p):
     # the first .replace is needed to help normpath when dealing with Windows
     # paths under *nix, the second to normalize to '/'
-    return os_path.normpath(p.replace('\\','/')).replace('\\','/')
+    return os_path.normpath(p.replace('\\', '/')).replace('\\', '/')
 
 import Products
 ProductsPath = [ abspath(ppath) for ppath in Products.__path__ ]
@@ -785,7 +769,7 @@
     tricks it into working with just a module name.
     """
     package = getContainingPackage(module)
-    return package_home({'__name__' : package})
+    return package_home({'__name__': package})
 
 security.declarePrivate('getPackageName')
 def getPackageName(globals_):
@@ -812,10 +796,10 @@
         # understand the screwy date string as a lucky side effect
         # of the way they parse it).
         try:
-            mod_since=DateTime(header)
-            mod_since=long(mod_since.timeTime())
+            mod_since = DateTime(header)
+            mod_since = long(mod_since.timeTime())
         except (TypeError, DateTimeError):
-            mod_since=None
+            mod_since = None
 
         if mod_since is not None:
             if last_mod > 0 and last_mod <= mod_since:
@@ -848,10 +832,10 @@
         # understand the screwy date string as a lucky side effect
         # of the way they parse it).
         try:
-            mod_since=DateTime(header)
-            mod_since=long(mod_since.timeTime())
+            mod_since = DateTime(header)
+            mod_since = long(mod_since.timeTime())
         except (TypeError, DateTimeError):
-            mod_since=None
+            mod_since = None
 
         if mod_since is not None:
             if last_mod > 0 and last_mod <= mod_since:



More information about the checkins mailing list