Merge pull request #2 from flashingpumpkin/master

Added Python 2.6 compatibility.
This commit is contained in:
Jakub Roztocil 2012-02-28 08:54:59 -08:00
commit f90ae113e4

View File

@ -27,10 +27,11 @@ class KeyValueType(object):
self.separators = separators
def __call__(self, string):
found = dict(
(string.find(sep), sep) for sep in self.separators
if string.find(sep) != -1
)
found = {string.find(sep): sep
for sep in self.separators
if string.find(sep) != -1}
if not found:
raise argparse.ArgumentTypeError(
'"%s" is not a valid value' % string)
@ -141,8 +142,8 @@ def main():
verify=True if args.verify == 'yes' else args.verify,
timeout=args.timeout,
auth=(args.auth.key, args.auth.value) if args.auth else None,
proxies={proxy.key: proxy.value for proxy in args.proxy},
files={os.path.basename(f.name): f for f in args.file}
proxies=dict((p.key, p.value) for p in args.proxy),
files=dict((os.path.basename(f.name), f) for f in args.file),
)
except (KeyboardInterrupt, SystemExit) as e:
sys.stderr.write('\n')