Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removed dictionary comprehensions for compatibility with Python 2.6 a…

…nd earlier.
  • Loading branch information...
commit 91692ecae347a8f14c198387cc05bbd0dde61bee 1 parent fa4e53c
Arthur Grunseid authored
Showing with 7 additions and 3 deletions.
  1. +7 −3 furl/furl.py
View
10 furl/furl.py
@@ -167,7 +167,9 @@ def __init__(self, query=None):
def parse(self, query):
if isinstance(query, dict):
- self.params = {k:urllib.unquote_plus(v) for k, v in query.iteritems()}
+ # py2.7+: {k:urllib.unquote_plus(v) for k, v in query.iteritems()}
+ tmp = dict((k,urllib.unquote_plus(v)) for (k,v) in query.iteritems())
+ self.params = tmp
else:
self.params = parse_qs(query)
@@ -191,7 +193,8 @@ def remove(self, query=None):
return self
def __str__(self):
- params = {str(key):str(val) for key, val in self.params.iteritems()}
+ # py2.7+: {str(key):str(val) for key, val in self.params.iteritems()}
+ params = dict((str(key),str(val)) for (key,val) in self.params.iteritems())
return urllib.urlencode(params)
def __repr__(self):
@@ -665,7 +668,8 @@ def parse_qs(query):
Parse a query string to a dictionary of parameter key:value pairs, removing
any duplicate url parameters. I.e. 'a=1&a=2' would become {'a':'1'}.
"""
- return {key:val[0] for key, val in urlparse.parse_qs(query).iteritems()}
+ # py2.7+: {key:val[0] for key, val in urlparse.parse_qs(query).iteritems()}
+ return dict((k,v[0]) for (k,v) in urlparse.parse_qs(query).iteritems())
def urlsplit(url):
"""
Please sign in to comment.
Something went wrong with that request. Please try again.