[CMF-checkins] CVS: CMF/CMFCore - RegistrationTool.py:1.19 SkinsTool.py:1.22 TypesTool.py:1.48

Yvo Schubbe schubbe@web.de
Tue, 4 Feb 2003 17:18:10 -0500


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

Modified Files:
	RegistrationTool.py SkinsTool.py TypesTool.py 
Log Message:
Merged yuppie-buglets1-branch:
- Fixed buglets. (Collector #94 and #95)
- Removed string functions and useless imports.

=== CMF/CMFCore/RegistrationTool.py 1.18 => 1.19 ===
--- CMF/CMFCore/RegistrationTool.py:1.18	Thu Jan 30 15:26:50 2003
+++ CMF/CMFCore/RegistrationTool.py	Tue Feb  4 17:18:07 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/SkinsTool.py 1.21 => 1.22 ===
--- CMF/CMFCore/SkinsTool.py:1.21	Thu Jan 23 09:19:58 2003
+++ CMF/CMFCore/SkinsTool.py	Tue Feb  4 17:18:07 2003
@@ -1,24 +1,25 @@
 ##############################################################################
 #
-# 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
-# 
+#
 ##############################################################################
 """Portal skins tool.
 
 $Id$
 """
 
-from string import split
 from utils import UniqueObject, getToolByName, _dtmldir
-import Globals
-from Globals import DTMLFile, PersistentMapping
+from Globals import DTMLFile
+from Globals import InitializeClass
+from Globals import PersistentMapping
 from SkinsContainer import SkinsContainer
 from Acquisition import aq_base
 from DateTime import DateTime
@@ -158,7 +159,7 @@
             an object of the appropriate type (or None, if we don't
             know what to do).
         """
-        major, minor = split( typ, '/' )
+        major, minor = typ.split('/', 1)
 
         if major == 'image':
             return Image( id=name
@@ -185,9 +186,8 @@
 
     security.declarePrivate('testSkinPath')
     def testSkinPath(self, p):
-        '''
-        Calls SkinsContainer.getSkinByPath().
-        '''
+        """ Calls SkinsContainer.getSkinByPath().
+        """
         self.getSkinByPath(p, raise_exc=1)
 
     #
@@ -309,4 +309,4 @@
         if make_default:
             self.default_skin = skinname
 
-Globals.InitializeClass(SkinsTool)
+InitializeClass(SkinsTool)


=== CMF/CMFCore/TypesTool.py 1.47 => 1.48 ===
--- CMF/CMFCore/TypesTool.py:1.47	Mon Jan  6 15:37:06 2003
+++ CMF/CMFCore/TypesTool.py	Tue Feb  4 17:18:07 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: