[CMF-checkins] CVS: CMF/CMFCore - RegistrationTool.py:1.17.2.1 TypesTool.py:1.47.2.1 URLTool.py:1.2.4.1 UndoTool.py:1.12.2.1

Yvo Schubbe schubbe@web.de
Sun, 12 Jan 2003 08:12:04 -0500


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

Modified Files:
      Tag: yuppie-buglets1-branch
	RegistrationTool.py TypesTool.py URLTool.py UndoTool.py 
Log Message:
use string methods:
- replaced string functions
- removed useless imports
- updated copyright statement

=== CMF/CMFCore/RegistrationTool.py 1.17 => 1.17.2.1 ===
--- CMF/CMFCore/RegistrationTool.py:1.17	Mon Jan  6 15:36:04 2003
+++ CMF/CMFCore/RegistrationTool.py	Sun Jan 12 08:12:01 2003
@@ -1,16 +1,16 @@
 ##############################################################################
 #
-# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-# 
+# Copyright (c) 2001-2003 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE
-# 
+#
 ##############################################################################
-
 """ Basic user registration tool.
 
 $Id$
@@ -20,6 +20,10 @@
 from Globals import DTMLFile
 from OFS.SimpleItem import SimpleItem
 from AccessControl import ClassSecurityInfo
+from random import choice
+from string import lowercase
+from string import uppercase
+from string import digits
 
 from ActionProviderBase import ActionProviderBase
 
@@ -31,7 +35,6 @@
 
 from utils import UniqueObject
 from utils import _checkPermission
-from utils import _getAuthenticatedUser
 from utils import _limitGrantedRoles
 from utils import getToolByName
 from utils import _dtmldir
@@ -92,12 +95,11 @@
         '''Generates a password which is guaranteed to comply
         with the password policy.
         '''
-        import string, random
-        chars = string.lowercase[:26] + string.uppercase[:26] + string.digits
+        chars = lowercase[:26] + uppercase[:26] + digits
         result = []
         for n in range(6):
-            result.append(random.choice(chars))
-        return string.join(result, '')
+            result.append( choice(chars) )
+        return ''.join(result)
 
     security.declareProtected(AddPortalMember, 'addMember')
     def addMember(self, id, password, roles=('Member',), domains='',


=== CMF/CMFCore/TypesTool.py 1.47 => 1.47.2.1 ===
--- CMF/CMFCore/TypesTool.py:1.47	Mon Jan  6 15:37:06 2003
+++ CMF/CMFCore/TypesTool.py	Sun Jan 12 08:12:01 2003
@@ -1,14 +1,15 @@
 ##############################################################################
 #
-# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-# 
+# Copyright (c) 2001-2003 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE
-# 
+#
 ##############################################################################
 """ Type registration tool.
 
@@ -17,9 +18,11 @@
 
 import OFS
 from Globals import InitializeClass, DTMLFile
-from utils import UniqueObject, SimpleItemWithProperties, tuplize
-from utils import _dtmldir, _checkPermission, cookString, getToolByName
-import string
+from utils import _checkPermission
+from utils import _dtmldir
+from utils import cookString
+from utils import SimpleItemWithProperties
+from utils import UniqueObject
 from AccessControl import getSecurityManager, ClassSecurityInfo, Unauthorized
 from Acquisition import aq_base
 import Products
@@ -224,7 +227,7 @@
                     return action['action']
             else:
                 # Temporary backward compatibility.
-                if string.lower(action['name']) == id:
+                if action['name'].lower() == id:
                     return action['action']
 
         if default is _marker:


=== CMF/CMFCore/URLTool.py 1.2 => 1.2.4.1 ===
--- CMF/CMFCore/URLTool.py:1.2	Wed Dec 11 17:21:49 2002
+++ CMF/CMFCore/URLTool.py	Sun Jan 12 08:12:01 2003
@@ -1,14 +1,15 @@
 ##############################################################################
 #
-# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-# 
+# Copyright (c) 2001-2003 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE
-# 
+#
 ##############################################################################
 """ CMFCore portal_url tool.
 
@@ -45,8 +46,8 @@
     security.declareObjectProtected(View)
 
     manage_options = ( ActionProviderBase.manage_options
-                     + ( {'label':'Overview'
-                         ,'action':'manage_overview'}
+                     + ( {'label':'Overview',
+                          'action':'manage_overview'}
                        ,
                        )
                      + SimpleItem.manage_options


=== CMF/CMFCore/UndoTool.py 1.12 => 1.12.2.1 ===
--- CMF/CMFCore/UndoTool.py:1.12	Mon Jan  6 15:37:20 2003
+++ CMF/CMFCore/UndoTool.py	Sun Jan 12 08:12:01 2003
@@ -1,26 +1,29 @@
 ##############################################################################
 #
-# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-# 
+# Copyright (c) 2001-2003 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE
-# 
+#
 ##############################################################################
 """ Basic undo tool.
 
 $Id$
 """
 
-from utils import UniqueObject, _getAuthenticatedUser, _checkPermission
-from utils import getToolByName, _dtmldir
 from OFS.SimpleItem import SimpleItem
 from Globals import InitializeClass, DTMLFile
-from string import split
 from AccessControl import ClassSecurityInfo, Unauthorized
+
+from utils import _checkPermission
+from utils import _dtmldir
+from utils import _getAuthenticatedUser
+from utils import UniqueObject
 from Expression import Expression
 from ActionInformation import ActionInformation
 from ActionProviderBase import ActionProviderBase
@@ -86,7 +89,7 @@
             user_id = _getAuthenticatedUser(self).getId()
             transactions = filter(
                 lambda record, user_id=user_id:
-                split(record['user_name'])[-1] == user_id,
+                record['user_name'].split()[-1] == user_id,
                 transactions
                 )
         return transactions