Log message for revision 103395: LP #418454: workaround for non-working FTP server under Python 2.6
Changed: U Zope/trunk/doc/CHANGES.rst U Zope/trunk/src/ZServer/FTPServer.py -=- Modified: Zope/trunk/doc/CHANGES.rst =================================================================== --- Zope/trunk/doc/CHANGES.rst 2009-08-31 12:51:37 UTC (rev 103394) +++ Zope/trunk/doc/CHANGES.rst 2009-08-31 12:57:23 UTC (rev 103395) @@ -78,6 +78,8 @@ 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. Modified: Zope/trunk/src/ZServer/FTPServer.py =================================================================== --- Zope/trunk/src/ZServer/FTPServer.py 2009-08-31 12:51:37 UTC (rev 103394) +++ Zope/trunk/src/ZServer/FTPServer.py 2009-08-31 12:57:23 UTC (rev 103395) @@ -64,6 +64,7 @@ """ +import sys from PubCore import handle from medusa.ftp_server import ftp_channel, ftp_server, recv_channel import asyncore, asynchat @@ -81,7 +82,9 @@ 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,14 +108,26 @@ 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 _______________________________________________ Zope-Checkins maillist - Zope-Checkins@zope.org https://mail.zope.org/mailman/listinfo/zope-checkins