[Zope-Checkins] CVS: Zope/ZServer - FTPRequest.py:1.12 FTPServer.py:1.20 HTTPResponse.py:1.33 HTTPServer.py:1.35 WebDAVSrcHandler.py:1.6 ZService.py:1.12
Andreas Jung
andreas@zope.com
Tue, 25 Sep 2001 10:24:27 -0400
Update of /cvs-repository/Zope/ZServer
In directory cvs.zope.org:/tmp/cvs-serv8633
Modified Files:
FTPRequest.py FTPServer.py HTTPResponse.py HTTPServer.py
WebDAVSrcHandler.py ZService.py
Log Message:
replace string module calls by string method calls
=== Zope/ZServer/FTPRequest.py 1.11 => 1.12 ===
import os
from base64 import encodestring
-import string,re
+import re
class FTPRequest(HTTPRequest):
@@ -192,7 +192,7 @@
path=apply(os.path.join,args)
path=os.path.normpath(path)
if os.sep != '/':
- path=string.replace(path,os.sep,'/')
+ path=path.replace(os.sep,'/')
return path
=== Zope/ZServer/FTPServer.py 1.19 => 1.20 ===
from cStringIO import StringIO
-import string
import os
from mimetypes import guess_type
import marshal
@@ -174,7 +173,7 @@
path=apply(os.path.join,args)
path=os.path.normpath(path)
if os.sep != '/':
- path=string.replace(path,os.sep,'/')
+ path=path.replace(os.sep,'/')
return path
# Overriden async_chat methods
@@ -210,7 +209,7 @@
# XXX clean this up, maybe with getopts
if len(line) > 1:
- args = string.split(line[1])
+ args = line[1].split()
else:
args =[]
path_args = []
@@ -220,7 +219,7 @@
for i in range(len(args)):
x = args[i]
- if string.find(x,'*')!=-1 or string.find(x,'?')!=-1:
+ if x.find('*')!=-1 or x.find('?')!=-1:
self.globbing = x
args[i] = '.'
@@ -318,7 +317,7 @@
def cmd_mdtm(self, line):
'show last modification time of file'
if len (line) != 2:
- self.command.not_understood (string.join (line))
+ self.command.not_understood (' '.join(line))
return
response=make_response(self, self.mdtm_completion)
request=FTPRequest(line[1],'MDTM',self,response)
@@ -345,7 +344,7 @@
def cmd_size(self, line):
'return size of file'
if len (line) != 2:
- self.command.not_understood (string.join (line))
+ self.command.not_understood (' '.join(line))
return
response=make_response(self, self.size_completion)
request=FTPRequest(line[1],'SIZE',self,response)
@@ -364,7 +363,7 @@
def cmd_retr(self,line):
if len(line) < 2:
- self.command_not_understood (string.join (line))
+ self.command_not_understood (' '.join(line))
return
response=make_response(self, self.retr_completion, line[1])
self._response_producers = response.stdout._producers
@@ -398,7 +397,7 @@
def cmd_stor (self, line, mode='wb'):
'store a file'
if len (line) < 2:
- self.command_not_understood (string.join (line))
+ self.command_not_understood (' '.join(line))
return
elif self.restart_position:
restart_position = 0
@@ -442,14 +441,14 @@
def cmd_rnfr (self, line):
'rename from'
if len (line) != 2:
- self.command_not_understood (string.join (line))
+ self.command_not_understood (' '.join(line))
else:
self.fromfile = line[1]
self.respond ('350 RNFR command successful.')
def cmd_rnto (self, line):
if len (line) != 2:
- self.command_not_understood (string.join (line))
+ self.command_not_understood (' '.join(line))
return
pathf,idf=os.path.split(self.fromfile)
patht,idt=os.path.split(line[1])
@@ -466,7 +465,7 @@
def cmd_dele(self, line):
if len (line) != 2:
- self.command.not_understood (string.join (line))
+ self.command.not_understood (' '.join (line))
return
path,id=os.path.split(line[1])
response=make_response(self, self.dele_completion)
@@ -475,7 +474,7 @@
def dele_completion(self,response):
status=response.getStatus()
- if status==200 and string.find(response.body,'Not Deletable')==-1:
+ if status==200 and response.body.find('Not Deletable')==-1:
self.respond('250 DELE command successful.')
elif status==401:
self.respond('530 Unauthorized.')
@@ -484,7 +483,7 @@
def cmd_mkd(self, line):
if len (line) != 2:
- self.command.not_understood (string.join (line))
+ self.command.not_understood (' '.join (line))
return
path,id=os.path.split(line[1])
response=make_response(self, self.mkd_completion)
@@ -506,7 +505,7 @@
# XXX should object be checked to see if it's folderish
# before we allow it to be RMD'd?
if len (line) != 2:
- self.command.not_understood (string.join (line))
+ self.command.not_understood (' '.join (line))
return
path,id=os.path.split(line[1])
response=make_response(self, self.rmd_completion)
@@ -517,7 +516,7 @@
def rmd_completion(self,response):
status=response.getStatus()
- if status==200 and string.find(response.body,'Not Deletable')==-1:
+ if status==200 and response.body.find('Not Deletable')==-1:
self.respond('250 RMD command successful.')
elif status==401:
self.respond('530 Unauthorized.')
@@ -530,7 +529,7 @@
self.userid = line[1]
self.respond('331 Password required.')
else:
- self.command_not_understood (string.join (line))
+ self.command_not_understood (' '.join (line))
def cmd_pass(self, line):
'specify password'
@@ -539,7 +538,7 @@
else:
pw = line[1]
self.password=pw
- i=string.find(self.userid,'@')
+ i=self.userid.find('@')
if i ==-1:
if self.server.limiter.check_limit(self):
self.respond ('230 Login successful.')
=== Zope/ZServer/HTTPResponse.py 1.32 => 1.33 ===
"""
-import time, re, string, sys, tempfile
+import time, re, sys, tempfile
from cStringIO import StringIO
import thread
from ZPublisher.HTTPResponse import HTTPResponse
@@ -186,20 +186,20 @@
self.setHeader('Connection','close')
for key, val in headers.items():
- if string.lower(key)==key:
+ if key.lower()==key:
# only change non-literal header names
- key="%s%s" % (string.upper(key[:1]), key[1:])
+ key="%s%s" % (key[:1].upper(), key[1:])
start=0
- l=string.find(key,'-',start)
+ l=key.find('-',start)
while l >= start:
- key="%s-%s%s" % (key[:l],string.upper(key[l+1:l+2]),key[l+2:])
+ key="%s-%s%s" % (key[:l],key[l+1:l+2].upper(),key[l+2:])
start=l+1
- l=string.find(key,'-',start)
+ l=key.find('-',start)
append("%s: %s" % (key, val))
if self.cookies:
headersl=headersl+self._cookie_list()
headersl[len(headersl):]=[self.accumulated_headers, body]
- return string.join(headersl,'\r\n')
+ return "\r\n".join(headersl)
_tempfile=None
_templock=None
@@ -226,7 +226,7 @@
l=self.headers.get('content-length', None)
if l is not None:
try:
- if type(l) is type(''): l=string.atoi(l)
+ if type(l) is type(''): l=int(l)
if l > 128000:
self._tempfile=tempfile.TemporaryFile()
self._templock=thread.allocate_lock()
@@ -356,7 +356,7 @@
'exceptions.SystemExit':
r=response.headers.get('bobo-exception-value','0')
- try: r=string.atoi(r)
+ try: r=int(r)
except: r = r and 1 or 0
self._shutdown=r,
if response.headers.get('connection','') == 'close' or \
@@ -371,8 +371,8 @@
response=ZServerHTTPResponse(stdout=ChannelPipe(request), stderr=StringIO())
response._http_version=request.version
- response._http_connection=string.lower(
- http_server.get_header(http_server.CONNECTION, request.header))
+ response._http_connection=(
+ http_server.get_header(http_server.CONNECTION, request.header)).lower()
response._server_version=request.channel.server.SERVER_IDENT
return response
=== Zope/ZServer/HTTPServer.py 1.34 => 1.35 ===
import sys
import re
-import string
import os
import types
import thread
=== Zope/ZServer/WebDAVSrcHandler.py 1.5 => 1.6 ===
from HTTPServer import zhttp_handler
-import string, os
+import os
class WebDAVSrcHandler( zhttp_handler ):
"""
@@ -112,7 +112,7 @@
path_info = os.path.join( path_info, 'manage_FTPget' )
path_info = os.path.normpath( path_info )
if os.sep != '/':
- path_info = string.replace( path_info, os.sep, '/' )
+ path_info = path_info.replace( os.sep, '/' )
env['PATH_INFO'] = path_info
@@ -121,7 +121,7 @@
# We check the user-agent and remove a trailing dot for PATH_INFO
# and PATH_TRANSLATED
- if string.find(env.get("HTTP_USER_AGENT",""),"Microsoft Data Access Internet Publishing Provider")>-1:
+ if env.get("HTTP_USER_AGENT","").find("Microsoft Data Access Internet Publishing Provider")>-1:
if env["PATH_INFO"][-1]=='.':
env["PATH_INFO"] = env["PATH_INFO"][:-1]
=== Zope/ZServer/ZService.py 1.11 => 1.12 ===
Requires Python win32api extensions.
"""
-import sys, os, string, time, imp
+import sys, os, time, imp
# Some fancy path footwork is required here because we
# may be run from python.exe or lib/win32/PythonService.exe
@@ -236,7 +236,7 @@
path=os.path.join(home, 'ZServer', 'svcname.txt')
file=open(path, 'r')
- _svc_name_=string.strip(file.readline())
+ _svc_name_=file.readline().strip()
file.close()
_svc_display_name_ = "Zope (%s)" % _svc_name_