summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/engine/url.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2006-08-22 18:58:01 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2006-08-22 18:58:01 +0000
commita8d1aecfabe288dcfce3c01bfd87a5a6aff3683c (patch)
tree506df1e9413dfcf96e475e9c668cf8bc52907283 /lib/sqlalchemy/engine/url.py
parent3003239bebcc545a865888ded899199a99faa72c (diff)
downloadsqlalchemy-a8d1aecfabe288dcfce3c01bfd87a5a6aff3683c.tar.gz
- urls support escaped characters in passwords [ticket:281]
Diffstat (limited to 'lib/sqlalchemy/engine/url.py')
-rw-r--r--lib/sqlalchemy/engine/url.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/sqlalchemy/engine/url.py b/lib/sqlalchemy/engine/url.py
index bd8ee2643..7c3d947ca 100644
--- a/lib/sqlalchemy/engine/url.py
+++ b/lib/sqlalchemy/engine/url.py
@@ -1,5 +1,6 @@
import re
import cgi
+import urllib
import sqlalchemy.exceptions as exceptions
class URL(object):
@@ -19,7 +20,7 @@ class URL(object):
if self.username is not None:
s += self.username
if self.password is not None:
- s += ':' + self.password
+ s += ':' + urllib.quote_plus(self.password)
s += "@"
if self.host is not None:
s += self.host
@@ -81,6 +82,8 @@ def _parse_rfc1738_args(name):
else:
query = None
opts = {'username':username,'password':password,'host':host,'port':port,'database':database, 'query':query}
+ if opts['password'] is not None:
+ opts['password'] = urllib.unquote_plus(opts['password'])
return URL(name, **opts)
else:
raise exceptions.ArgumentError("Could not parse rfc1738 URL from string '%s'" % name)