diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-06-03 13:13:16 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-06-03 13:13:16 -0400 |
commit | 74c98bf182a1cac1ca1837da69e1c0550beaaab5 (patch) | |
tree | 4815d198d2aa4a6497330fb5d81e53bf4acfbb2d /lib/sqlalchemy/engine/url.py | |
parent | ff399ac75074916045410cedae72489cb60e8b50 (diff) | |
parent | c2a158c137ee07a146f02e5ee89ec42e486c6a37 (diff) | |
download | sqlalchemy-74c98bf182a1cac1ca1837da69e1c0550beaaab5.tar.gz |
Merge branch 'master' into ticket_1068
Diffstat (limited to 'lib/sqlalchemy/engine/url.py')
-rw-r--r-- | lib/sqlalchemy/engine/url.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/sqlalchemy/engine/url.py b/lib/sqlalchemy/engine/url.py index c4931b48c..ed5729eea 100644 --- a/lib/sqlalchemy/engine/url.py +++ b/lib/sqlalchemy/engine/url.py @@ -14,7 +14,6 @@ be used directly and is also accepted directly by ``create_engine()``. """ import re -import urllib from .. import exc, util from . import Dialect @@ -67,7 +66,7 @@ class URL(object): if self.username is not None: s += self.username if self.password is not None: - s += ':' + urllib.quote_plus(self.password) + s += ':' + util.quote_plus(self.password) s += "@" if self.host is not None: s += self.host @@ -76,7 +75,7 @@ class URL(object): if self.database is not None: s += '/' + self.database if self.query: - keys = self.query.keys() + keys = list(self.query) keys.sort() s += '?' + "&".join("%s=%s" % (k, self.query[k]) for k in keys) return s @@ -150,7 +149,7 @@ def make_url(name_or_url): existing URL object is passed, just returns the object. """ - if isinstance(name_or_url, basestring): + if isinstance(name_or_url, util.string_types): return _parse_rfc1738_args(name_or_url) else: return name_or_url @@ -177,17 +176,15 @@ def _parse_rfc1738_args(name): tokens = components['database'].split('?', 2) components['database'] = tokens[0] query = (len(tokens) > 1 and dict(util.parse_qsl(tokens[1]))) or None - # Py2K - if query is not None: + if util.py2k and query is not None: query = dict((k.encode('ascii'), query[k]) for k in query) - # end Py2K else: query = None components['query'] = query if components['password'] is not None: components['password'] = \ - urllib.unquote_plus(components['password']) + util.unquote_plus(components['password']) name = components.pop('name') return URL(name, **components) |