[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Security - SecurityManager.py:1.1.2.7 ZopeSecurityPolicy.py:1.1.2.16
Martijn Pieters
mj@zope.com
Wed, 13 Feb 2002 00:03:36 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/Security
In directory cvs.zope.org:/tmp/cvs-serv14206/App/Security
Modified Files:
Tag: Zope-3x-branch
SecurityManager.py ZopeSecurityPolicy.py
Log Message:
Optimizations and code style updates:
- Use isinstance on type checks
- Test UnicodeType and StringType through StringTypes
- Remove use of the string module
- Use startswith and endswith instead of slices.
- Fix weird tests where isinstance suffices.
=== Zope3/lib/python/Zope/App/Security/SecurityManager.py 1.1.2.6 => 1.1.2.7 ===
""" Default ISecurityManager implementation """
-import os, string
+import os
from SimpleSecurityPolicies import ParanoidSecurityPolicy
MAX_STACK_SIZE = 100
=== Zope3/lib/python/Zope/App/Security/ZopeSecurityPolicy.py 1.1.2.15 => 1.1.2.16 ===
__version__='$Revision$'[11:-2]
-import string
from types import StringType, TupleType
from Zope.ComponentArchitecture import getAdapter
@@ -177,11 +176,11 @@
#
# Helper methods
#
- def _allowName( self, name, strip=string.strip ):
+ def _allowName( self, name ):
"""
Is 'name' ever allowed to be retrieved under this policy?
"""
- return name and type( name ) is StringType and strip( name )
+ return name and isinstance(name, StringType) and name.strip()
def _findPermission( self, value ):
"""