Commit f9f0ddd0 authored by 's avatar

merge from 2.3

parent 840802e5
......@@ -162,6 +162,12 @@ class FTPRequest(HTTPRequest):
env['PATH_INFO']=self._join_paths(channel.path,
path, 'manage_addFolder')
env['QUERY_STRING']='id=%s' % args[0]
elif command=='RNTO':
env['PATH_INFO']=self._join_paths(channel.path,
path, 'manage_renameObject')
env['QUERY_STRING']='id=%s&new_id=%s' % (args[0],args[1])
elif command=='STOR':
env['PATH_INFO']=self._join_paths(channel.path, path)
env['REQUEST_METHOD']='PUT'
......
......@@ -411,7 +411,32 @@ class zope_ftp_channel(ftp_channel):
else:
self.client_dc.channel.respond('426 Error creating file.')
self.client_dc.close()
def cmd_rnfr (self, line):
'rename from'
if len (line) != 2:
self.command_not_understood (string.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))
return
pathf,idf=os.path.split(self.fromfile)
patht,idt=os.path.split(line[1])
response=make_response(self, self.rnto_completion)
request=FTPRequest(pathf,('RNTO',idf,idt),self,response)
handle(self.module,request,response)
def rnto_completion(self,response):
status=response.getStatus()
if status==200:
self.respond ('250 RNTO command successful.')
else:
self.respond ('550 error renaming file.')
def cmd_dele(self, line):
if len (line) != 2:
self.command.not_understood (string.join (line))
......@@ -532,6 +557,7 @@ class zope_ftp_channel(ftp_channel):
self.respond('502 Command not implemented.')
# Override ftp server receive channel reponse mechanism
# XXX hack alert, this should probably be redone in a more OO way.
......
......@@ -162,6 +162,12 @@ class FTPRequest(HTTPRequest):
env['PATH_INFO']=self._join_paths(channel.path,
path, 'manage_addFolder')
env['QUERY_STRING']='id=%s' % args[0]
elif command=='RNTO':
env['PATH_INFO']=self._join_paths(channel.path,
path, 'manage_renameObject')
env['QUERY_STRING']='id=%s&new_id=%s' % (args[0],args[1])
elif command=='STOR':
env['PATH_INFO']=self._join_paths(channel.path, path)
env['REQUEST_METHOD']='PUT'
......
......@@ -411,7 +411,32 @@ class zope_ftp_channel(ftp_channel):
else:
self.client_dc.channel.respond('426 Error creating file.')
self.client_dc.close()
def cmd_rnfr (self, line):
'rename from'
if len (line) != 2:
self.command_not_understood (string.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))
return
pathf,idf=os.path.split(self.fromfile)
patht,idt=os.path.split(line[1])
response=make_response(self, self.rnto_completion)
request=FTPRequest(pathf,('RNTO',idf,idt),self,response)
handle(self.module,request,response)
def rnto_completion(self,response):
status=response.getStatus()
if status==200:
self.respond ('250 RNTO command successful.')
else:
self.respond ('550 error renaming file.')
def cmd_dele(self, line):
if len (line) != 2:
self.command.not_understood (string.join (line))
......@@ -532,6 +557,7 @@ class zope_ftp_channel(ftp_channel):
self.respond('502 Command not implemented.')
# Override ftp server receive channel reponse mechanism
# XXX hack alert, this should probably be redone in a more OO way.
......
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