diff mercurial/byterange.py @ 674:6513ba7d858a

Make consistent use of str.startswith() in conditionals. # HG changeset patch # User chad.netzer@gmail.com # Node ID 45db196de89a15fd045cd789f701b0180fd276f1 # Parent fafc16f705b6cb413897577b67918af55e1baafe Make consistent use of str.startswith() in conditionals.
author chad.netzer@gmail.com
date Sun, 10 Jul 2005 16:14:56 -0800
parents 31a9aa890016
children eb0b4a2d70a9
line wrap: on
line diff
--- a/mercurial/byterange.py	Sun Jul 10 16:14:41 2005 -0800
+++ b/mercurial/byterange.py	Sun Jul 10 16:14:56 2005 -0800
@@ -361,12 +361,12 @@
                 cmd = 'RETR ' + file
                 conn = self.ftp.ntransfercmd(cmd, rest)
             except ftplib.error_perm, reason:
-                if str(reason)[:3] == '501':
+                if str(reason).startswith('501'):
                     # workaround for REST not supported error
                     fp, retrlen = self.retrfile(file, type)
                     fp = RangeableFileObject(fp, (rest,''))
                     return (fp, retrlen)
-                elif str(reason)[:3] != '550':
+                elif not str(reason).startswith('550'):
                     raise IOError, ('ftp error', reason), sys.exc_info()[2]
         if not conn:
             # Set transfer mode to ASCII!