Author: phd
Date: 2006-08-29 08:20:29 -0600 (Tue, 29 Aug 2006)
New Revision: 1888
Modified:
SQLObject/branches/0.7-bugfix/sqlobject/dbconnection.py
SQLObject/branches/0.7-bugfix/sqlobject/tests/test_parse.py
Log:
Applied a patch by Ivan Horvath <i.h...@al...> to fix the bug 1426574:
Database passwords with '@' don't parse correctly.
Modified: SQLObject/branches/0.7-bugfix/sqlobject/dbconnection.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/dbconnection.py 2006-08-29 14:20:14 UTC (rev 1887)
+++ SQLObject/branches/0.7-bugfix/sqlobject/dbconnection.py 2006-08-29 14:20:29 UTC (rev 1888)
@@ -95,7 +95,7 @@
else:
host, rest = rest.split('/', 1)
if host and host.find('@') != -1:
- user, host = host.split('@', 1)
+ user, host = host.rsplit('@', 1)
if user.find(':') != -1:
user, password = user.split(':', 1)
else:
Modified: SQLObject/branches/0.7-bugfix/sqlobject/tests/test_parse.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/tests/test_parse.py 2006-08-29 14:20:14 UTC (rev 1887)
+++ SQLObject/branches/0.7-bugfix/sqlobject/tests/test_parse.py 2006-08-29 14:20:29 UTC (rev 1888)
@@ -48,6 +48,14 @@
assert path == "/full/path/to/socket/database"
assert args == {}
+ user, password, host, port, path, args = _parseURI("postgres://user:at@inpwd@host/database")
+ assert user == "user"
+ assert password == "at@inpwd"
+ assert host == "host"
+ assert port is None
+ assert path == "/database"
+ assert args == {}
+
user, password, host, port, path, args = _parseURI("sqlite:///full/path/to/database")
assert user is None
assert password is None
|