Author: phd
Date: Tue Feb 22 07:44:08 2011
New Revision: 4337
Log:
Fixed a minor bug: Python < 2.7 have a problem - splituser() calls unquote() too early.
Modified:
SQLObject/trunk/docs/TODO.txt
SQLObject/trunk/sqlobject/dbconnection.py
Modified: SQLObject/trunk/docs/TODO.txt
==============================================================================
--- SQLObject/trunk/docs/TODO.txt Tue Feb 22 07:32:59 2011 (r4336)
+++ SQLObject/trunk/docs/TODO.txt Tue Feb 22 07:44:08 2011 (r4337)
@@ -59,6 +59,8 @@
* Stop supporting Python 2.5: remove import sets.
+* Stop supporting Python 2.6: restore using urllib.splituser in _parseURI.
+
* Expression columns - in SELECT but not in INSERT/UPDATE. Something like this::
class MyClass(SQLObject):
Modified: SQLObject/trunk/sqlobject/dbconnection.py
==============================================================================
--- SQLObject/trunk/sqlobject/dbconnection.py Tue Feb 22 07:32:59 2011 (r4336)
+++ SQLObject/trunk/sqlobject/dbconnection.py Tue Feb 22 07:44:08 2011 (r4337)
@@ -172,9 +172,12 @@
host, path = urllib.splithost(request)
if host:
- user, host = urllib.splituser(host)
+ # Python < 2.7 have a problem - splituser() calls unquote() too early
+ #user, host = urllib.splituser(host)
+ if '@' in host:
+ user, host = host.split('@', 1)
if user:
- user, password = urllib.splitpasswd(user)
+ user, password = [urllib.unquote(x) for x in urllib.splitpasswd(user)]
host, port = urllib.splitport(host)
if port: port = int(port)
elif host == '':
|