[Zope-dev] Poor programming practice?
Robin Becker
robin@jessikat.fsnet.co.uk
Wed, 31 Jan 2001 08:28:51 +0000
I have been trying to make use of the builtin medusa ftp_server classes
and after struggling a while came across the strange practice some
internal zope developer has of dynamically changing classes at runtime.
ie in ZServer.FTPServer I came across
from medusa.ftp_server import ftp_channel, ftp_server, recv_channel
.......
.......
# Override ftp server receive channel reponse mechanism
# XXX hack alert, this should probably be redone in a more OO way.
def handle_close (self):
..........
self.readable=lambda :0 # don't call close again
recv_channel.handle_close=handle_close
which makes it virtually impossible to re-use medusa's ftp_server in a
reasonable way. The comment says it all.
The real problem is that ftp_channel uses a method make_recv_channel
which uses a global class recv_channel and the recv_channel class has a
particular method which zope wants to override. How ought this kind of
situation to be handled more cleanly?
--
Robin Becker