Commit 6ab4f9e8 authored by 's avatar

Merged fix for FTP error messages (bug # 1992)

parent 824e0e1f
...@@ -120,6 +120,11 @@ class FTPResponse(ZServerHTTPResponse): ...@@ -120,6 +120,11 @@ class FTPResponse(ZServerHTTPResponse):
def _marshalledBody(self): def _marshalledBody(self):
return marshal.loads(self.body) return marshal.loads(self.body)
def setMessage(self, message):
self._message = message
def getMessage(self):
return getattr(self, '_message', '')
class CallbackPipe: class CallbackPipe:
""" """
......
...@@ -404,12 +404,17 @@ class zope_ftp_channel(ftp_channel): ...@@ -404,12 +404,17 @@ class zope_ftp_channel(ftp_channel):
def stor_completion(self,response): def stor_completion(self,response):
status=response.getStatus() status=response.getStatus()
message = response.getMessage()
if status in (200,201,204,302): if status in (200,201,204,302):
self.client_dc.channel.respond('226 Transfer complete.') self.client_dc.channel.respond('226 ' + (
message or 'Transfer complete.'))
elif status==401: elif status==401:
self.client_dc.channel.respond('426 Unauthorized.') self.client_dc.channel.respond('426 ' + (
message or 'Unauthorized.'))
else: else:
self.client_dc.channel.respond('426 Error creating file.') self.client_dc.channel.respond('426 ' + (
message or 'Error creating file.'))
self.client_dc.close() self.client_dc.close()
def cmd_rnfr (self, line): def cmd_rnfr (self, line):
......
...@@ -120,6 +120,11 @@ class FTPResponse(ZServerHTTPResponse): ...@@ -120,6 +120,11 @@ class FTPResponse(ZServerHTTPResponse):
def _marshalledBody(self): def _marshalledBody(self):
return marshal.loads(self.body) return marshal.loads(self.body)
def setMessage(self, message):
self._message = message
def getMessage(self):
return getattr(self, '_message', '')
class CallbackPipe: class CallbackPipe:
""" """
......
...@@ -404,12 +404,17 @@ class zope_ftp_channel(ftp_channel): ...@@ -404,12 +404,17 @@ class zope_ftp_channel(ftp_channel):
def stor_completion(self,response): def stor_completion(self,response):
status=response.getStatus() status=response.getStatus()
message = response.getMessage()
if status in (200,201,204,302): if status in (200,201,204,302):
self.client_dc.channel.respond('226 Transfer complete.') self.client_dc.channel.respond('226 ' + (
message or 'Transfer complete.'))
elif status==401: elif status==401:
self.client_dc.channel.respond('426 Unauthorized.') self.client_dc.channel.respond('426 ' + (
message or 'Unauthorized.'))
else: else:
self.client_dc.channel.respond('426 Error creating file.') self.client_dc.channel.respond('426 ' + (
message or 'Error creating file.'))
self.client_dc.close() self.client_dc.close()
def cmd_rnfr (self, line): def cmd_rnfr (self, line):
......
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