Commit c7eaa6fb authored by Andreas Jung's avatar Andreas Jung

LP #418454: workaround for non-working FTP server under Python 2.6

parent e84355fc
......@@ -78,6 +78,8 @@ Features Added
Bugs Fixed
++++++++++
- LP #418454: FTP server did not work with Python 2.6.X
- Fixed issue with sending text containing ':' from MailHost.
- MailHost will now ensure the headers it sets are 7bit.
......
......@@ -64,6 +64,7 @@ FTP Authorization
"""
import sys
from PubCore import handle
from medusa.ftp_server import ftp_channel, ftp_server, recv_channel
import asyncore, asynchat
......@@ -81,6 +82,8 @@ import marshal
import stat
import time
py26_or_later = sys.version_info >= (2,6)
class zope_ftp_channel(ftp_channel):
"Passes its commands to Zope, not a filesystem"
......@@ -105,13 +108,25 @@ class zope_ftp_channel(ftp_channel):
return path
# Overriden async_chat methods
def push(self, producer, send=1):
def push(self, data, send=1):
# this is thread-safe when send is false
# note, that strings are not wrapped in
# producers by default
self.producer_fifo.push(producer)
if send: self.initiate_send()
# LP #418454
if py26_or_later:
# Python 2.6 or later
sabs = self.ac_out_buffer_size
if len(data) > sabs:
for i in xrange(0, len(data), sabs):
self.producer_fifo.append(data[i:i+sabs])
else:
self.producer_fifo.append(data)
else:
# pre-Python 2.6
self.producer_fifo.push(data)
if send:
self.initiate_send()
push_with_producer=push
......
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