[Twisted-Python] Re: [Twisted-commits] r14280 - Less fragile error checking.
On Sun, 21 Aug 2005 00:14:57 -0600, Andrew Bennetts
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
participants (1)
-
Jp Calderone