Commit b22186c3 authored by Andreas Jung's avatar Andreas Jung

replaced string module calls by string methods

parent 85579311
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
############################################################################## ##############################################################################
"""Zope Framework Class Finder """Zope Framework Class Finder
""" """
from string import strip
import OFS.Uninstalled import OFS.Uninstalled
def ClassFactory(jar, module, name, def ClassFactory(jar, module, name,
......
...@@ -84,7 +84,7 @@ AccessControl.SecurityManagement.noSecurityManager() ...@@ -84,7 +84,7 @@ AccessControl.SecurityManagement.noSecurityManager()
# This is sneaky, but we don't want to play with Main: # This is sneaky, but we don't want to play with Main:
sys.modules['Main']=sys.modules['Zope'] sys.modules['Main']=sys.modules['Zope']
import ZODB.POSException, ZPublisher, string, ZPublisher import ZODB.POSException, ZPublisher, ZPublisher
import ExtensionClass import ExtensionClass
from zLOG import LOG, WARNING, INFO, BLATHER, log_time from zLOG import LOG, WARNING, INFO, BLATHER, log_time
conflict_errors = 0 conflict_errors = 0
...@@ -179,13 +179,13 @@ class TransactionsManager: ...@@ -179,13 +179,13 @@ class TransactionsManager:
def recordMetaData(self, object, request, def recordMetaData(self, object, request,
# Optimize global var lookups: # Optimize global var lookups:
hasattr=hasattr, join=string.join, getattr=getattr, hasattr=hasattr, getattr=getattr,
get_transaction=get_transaction, get_transaction=get_transaction,
LOG=LOG, WARNING=WARNING, LOG=LOG, WARNING=WARNING,
): ):
request_get = request.get request_get = request.get
if hasattr(object, 'getPhysicalPath'): if hasattr(object, 'getPhysicalPath'):
path = join(object.getPhysicalPath(), '/') path = '/'.join(object.getPhysicalPath())
else: else:
# Try hard to get the physical path of the object, # Try hard to get the physical path of the object,
# but there are many circumstances where that's not possible. # but there are many circumstances where that's not possible.
...@@ -206,7 +206,7 @@ class TransactionsManager: ...@@ -206,7 +206,7 @@ class TransactionsManager:
object = getattr(object, 'aq_parent', None) object = getattr(object, 'aq_parent', None)
if object is not None: if object is not None:
path = join(object.getPhysicalPath() + to_append, '/') path = '/'.join(object.getPhysicalPath() + to_append)
else: else:
# As Jim would say, "Waaaaaaaa!" # As Jim would say, "Waaaaaaaa!"
# This may cause problems with virtual hosts # This may cause problems with virtual hosts
...@@ -228,7 +228,7 @@ class TransactionsManager: ...@@ -228,7 +228,7 @@ class TransactionsManager:
% str(type(auth_user))) % str(type(auth_user)))
auth_path = request_get('AUTHENTICATION_PATH') auth_path = request_get('AUTHENTICATION_PATH')
else: else:
auth_path = join(auth_folder.getPhysicalPath()[1:-1], '/') auth_path = '/'.join(auth_folder.getPhysicalPath()[1:-1])
T.setUser(auth_user, auth_path) T.setUser(auth_user, auth_path)
......
...@@ -221,7 +221,7 @@ if swhome != 'INSERT_SOFTWARE_HOME': ...@@ -221,7 +221,7 @@ if swhome != 'INSERT_SOFTWARE_HOME':
sys.path.insert(5, '%s' % swhome) sys.path.insert(5, '%s' % swhome)
import os, sys, getopt, string import os, sys, getopt
sys.setcheckinterval(120) sys.setcheckinterval(120)
...@@ -311,7 +311,7 @@ DETAILED_LOG_FILE='' ...@@ -311,7 +311,7 @@ DETAILED_LOG_FILE=''
def server_info(old, v, offset=0): def server_info(old, v, offset=0):
# interpret v as a port or address/port and get new value # interpret v as a port or address/port and get new value
if v == '-': v='' if v == '-': v=''
l=string.find(v, ':') l=v.find(':')
if l >= 0: if l >= 0:
a=v[:l] a=v[:l]
v=v[l+1:] v=v[l+1:]
...@@ -321,7 +321,7 @@ def server_info(old, v, offset=0): ...@@ -321,7 +321,7 @@ def server_info(old, v, offset=0):
if not v: return v if not v: return v
try: try:
v=string.atoi(v) v=int(v)
if v < 0: raise 'Invalid port', v if v < 0: raise 'Invalid port', v
v=v+offset v=v+offset
except: raise 'Invalid port', v except: raise 'Invalid port', v
...@@ -333,8 +333,8 @@ def server_info(old, v, offset=0): ...@@ -333,8 +333,8 @@ def server_info(old, v, offset=0):
try: try:
if string.split(sys.version)[0] < '2.1': if sys.version.split()[0] < '2.1':
raise 'Invalid python version', string.split(sys.version)[0] raise 'Invalid python version', sys.version.split()[0]
opts, args = getopt.getopt(sys.argv[1:], opts, args = getopt.getopt(sys.argv[1:],
'hz:Z:t:i:a:d:u:w:W:f:p:m:Sl:2DP:rF:L:XM:') 'hz:Z:t:i:a:d:u:w:W:f:p:m:Sl:2DP:rF:L:XM:')
...@@ -344,10 +344,10 @@ try: ...@@ -344,10 +344,10 @@ try:
# Get environment variables # Get environment variables
for a in args: for a in args:
if string.find(a,'='): if a.find('='):
a=string.split(a,'=') a=a.split('=')
o=a[0] o=a[0]
v=string.join(a[1:],'=') v='='.join(a[1:])
if o: if o:
os.environ[o]=v os.environ[o]=v
HTTP_ENV[o]=v HTTP_ENV[o]=v
...@@ -361,12 +361,12 @@ try: ...@@ -361,12 +361,12 @@ try:
Zpid=v Zpid=v
elif o=='-r': READ_ONLY=1 elif o=='-r': READ_ONLY=1
elif o=='-t': elif o=='-t':
try: v=string.atoi(v) try: v=int(v)
except: raise 'Invalid number of threads', v except: raise 'Invalid number of threads', v
NUMBER_OF_THREADS=v NUMBER_OF_THREADS=v
elif o=='-i': elif o=='-i':
try: v=string.atoi(v) try: v=int(v)
except: raise 'Invalid value for -i option', v except: raise 'Invalid value for -i option', v
sys.setcheckinterval(v) sys.setcheckinterval(v)
...@@ -540,7 +540,7 @@ try: ...@@ -540,7 +540,7 @@ try:
else: else:
lg = logger.syslog_logger(os.environ['ZSYSLOG']) lg = logger.syslog_logger(os.environ['ZSYSLOG'])
elif os.environ.has_key('ZSYSLOG_SERVER'): elif os.environ.has_key('ZSYSLOG_SERVER'):
(addr, port) = string.split(os.environ['ZSYSLOG_SERVER'], ':') (addr, port) = os.environ['ZSYSLOG_SERVER'].split( ':')
lg = logger.syslog_logger((addr, int(port))) lg = logger.syslog_logger((addr, int(port)))
else: else:
lg = logger.file_logger(LOG_PATH) lg = logger.file_logger(LOG_PATH)
...@@ -621,7 +621,7 @@ try: ...@@ -621,7 +621,7 @@ try:
fcgiPort = None fcgiPort = None
fcgiPath = None fcgiPath = None
try: try:
fcgiPort = string.atoi(FCGI_PORT) fcgiPort = int(FCGI_PORT)
except ValueError: except ValueError:
fcgiPath = FCGI_PORT fcgiPath = FCGI_PORT
zfcgi = FCGIServer(module=MODULE, zfcgi = FCGIServer(module=MODULE,
...@@ -656,7 +656,7 @@ try: ...@@ -656,7 +656,7 @@ try:
try: try:
import pwd import pwd
try: try:
try: UID = string.atoi(UID) try: UID = int(UID)
except: pass except: pass
gid = None gid = None
if type(UID) == type(""): if type(UID) == type(""):
......
...@@ -13,9 +13,9 @@ ...@@ -13,9 +13,9 @@
############################################################################## ##############################################################################
"""Zope user bootstrap system""" """Zope user bootstrap system"""
__version__='$Revision: 1.13 $ '[11:-2] __version__='$Revision: 1.14 $ '[11:-2]
import sys, string, sha, binascii, whrandom, getopt, getpass, os import sys, sha, binascii, whrandom, getopt, getpass, os
try: try:
from crypt import crypt from crypt import crypt
...@@ -30,7 +30,7 @@ def generate_salt(): ...@@ -30,7 +30,7 @@ def generate_salt():
return whrandom.choice(salt_choices)+whrandom.choice(salt_choices) return whrandom.choice(salt_choices)+whrandom.choice(salt_choices)
def generate_passwd(password, encoding): def generate_passwd(password, encoding):
encoding=string.upper(encoding) encoding=encoding.upper()
if encoding == 'SHA': if encoding == 'SHA':
pw = '{SHA}' + binascii.b2a_base64(sha.new(password).digest())[:-1] pw = '{SHA}' + binascii.b2a_base64(sha.new(password).digest())[:-1]
elif encoding == 'CRYPT': elif encoding == 'CRYPT':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment