[Twisted-Python] Re: [Twisted-commits] r14280 - Less fragile error checking.

21 Aug
2005
21 Aug
'05
1:04 p.m.
On Sun, 21 Aug 2005 00:14:57 -0600, Andrew Bennetts spiv@wolfwood.twistedmatrix.com wrote:
Author: spiv Date: Sun Aug 21 00:14:54 2005 New Revision: 14280
Modified: trunk/twisted/protocols/ftp.py Log: Less fragile error checking.
Modified: trunk/twisted/protocols/ftp.py
--- trunk/twisted/protocols/ftp.py (original) +++ trunk/twisted/protocols/ftp.py Sun Aug 21 00:14:54 2005 @@ -598,7 +598,8 @@ if err.check(FTPCmdError): msg = RESPONSE[err.value.errorCode] % (err.value.errorMessage,) self.sendLine(msg)
elif err.check(TypeError):
elif (err.check(TypeError) and
err.value.args[0].find('takes exactly') != -1): self.reply(SYNTAX_ERR, "%s requires an argument." % (cmd,)) else: log.msg("Unexpected FTP error")
If you want to make it "less fragile", please use inspect.getargspec() to determine the number of arguments it expects. Messages are likely to be changed or localized.
Jp
6433
Age (days ago)
6433
Last active (days ago)
0 comments
1 participants
participants (1)
-
Jp Calderone