=== modified file 'gluon/dal.py'
--- gluon/dal.py	2010-08-20 02:23:01 +0000
+++ gluon/dal.py	2010-12-05 00:40:20 +0000
@@ -53,6 +53,8 @@
 import portalocker
 import validators
 
+from urllib import unquote_plus
+
 logger = logging.getLogger("web2py.dal")
 
 sql_locker = thread.allocate_lock()
@@ -912,20 +914,20 @@
         if not m:
             raise SyntaxError, \
                 "Invalid URI string in DAL: %s" % self.uri
-        user = m.group('user')
+        user = unquote_plus(m.group('user'))
         if not user:
             raise SyntaxError, 'User required'
-        password = m.group('password')
+        password = unquote_plus(m.group('password'))
         if not password:
             password = ''
-        host = m.group('host')
+        host = unquote_plus(m.group('host'))
         if not host:
             raise SyntaxError, 'Host name required'
-        db = m.group('db')
+        db = unquote_plus(m.group('db'))
         if not db:
             raise SyntaxError, 'Database name required'
         port = int(m.group('port') or '3306')
-        charset = m.group('charset') or 'utf8'
+        charset = unquote_plus(m.group('charset') or 'utf8')
         self.pool_connection(lambda db=db,
                              user=user,
                              password=password,
@@ -999,16 +1001,16 @@
         m = re.compile('^(?P<user>[^:@]+)(\:(?P<password>[^@]*))?@(?P<host>[^\:/]+)(\:(?P<port>[0-9]+))?/(?P<db>.+)$').match(uri)
         if not m:
             raise SyntaxError, "Invalid URI string in DAL"
-        user = m.group('user')
+        user = unquote_plus(m.group('user'))
         if not user:
             raise SyntaxError, 'User required'
-        password = m.group('password')
+        password = unquote_plus(m.group('password'))
         if not password:
             password = ''
-        host = m.group('host')
+        host = unquote_plus(m.group('host'))
         if not host:
             raise SyntaxError, 'Host name required'
-        db = m.group('db')
+        db = unquote_plus(m.group('db'))
         if not db:
             raise SyntaxError, 'Database name required'
         port = m.group('port') or '5432'
@@ -1038,16 +1040,16 @@
         m = re.compile('^(?P<user>[^:@]+)(\:(?P<password>[^@]*))?@(?P<host>[^\:/]+)(\:(?P<port>[0-9]+))?/(?P<db>.+)$').match(uri)
         if not m:
             raise SyntaxError, "Invalid URI string in DAL"
-        user = m.group('user')
+        user = unquote_plus(m.group('user'))
         if not user:
             raise SyntaxError, 'User required'
-        password = m.group('password')
+        password = unquote_plus(m.group('password'))
         if not password:
             password = ''
-        host = m.group('host')
+        host = unquote_plus(m.group('host'))
         if not host:
             raise SyntaxError, 'Host name required'
-        db = m.group('db')
+        db = unquote_plus(m.group('db'))
         if not db:
             raise SyntaxError, 'Database name required'
         port = m.group('port') or '5432'
@@ -1249,16 +1251,16 @@
             if not m:
                 raise SyntaxError, \
                     "Invalid URI string in DAL: %s" % uri
-            user = m.group('user')
+            user = unquote_plus(m.group('user'))
             if not user:
                 raise SyntaxError, 'User required'
-            password = m.group('password')
+            password = unquote_plus(m.group('password'))
             if not password:
                 password = ''
-            host = m.group('host')
+            host = unquote_plus(m.group('host'))
             if not host:
                 raise SyntaxError, 'Host name required'
-            db = m.group('db')
+            db = unquote_plus(m.group('db'))
             if not db:
                 raise SyntaxError, 'Database name required'
             port = m.group('port') or '1433'
@@ -1381,19 +1383,19 @@
         m = re.compile('^(?P<user>[^:@]+)(\:(?P<password>[^@]*))?@(?P<host>[^\:/]+)(\:(?P<port>[0-9]+))?/(?P<db>.+?)(\?set_encoding=(?P<charset>\w+))?$').match(uri)
         if not m:
             raise SyntaxError, "Invalid URI string in DAL: %s" % uri
-        user = m.group('user')
+        user = unquote_plus(m.group('user'))
         if not user:
             raise SyntaxError, 'User required'
-        password = m.group('password')
+        password = unquote_plus(m.group('password'))
         if not password:
             password = ''
-        host = m.group('host')
+        host = unquote_plus(m.group('host'))
         if not host:
             raise SyntaxError, 'Host name required'
-        db = m.group('db')
+        db = unquote_plus(m.group('db'))
         if not db:
             raise SyntaxError, 'Database name required'
-        charset = m.group('charset') or 'UTF8'
+        charset = unquote_plus(m.group('charset') or 'UTF8')
         self.pool_connection(lambda dsn='%s/%s:%s' % (host,port,db),
                              user=user,
                              password=password,
@@ -1434,18 +1436,16 @@
         if not m:
             raise SyntaxError, \
                 "Invalid URI string in DAL: %s" % self.uri
-        user = m.group('user')
+        user = unquote_plus(m.group('user'))
         if not user:
             raise SyntaxError, 'User required'
-        password = m.group('password')
+        password = unquote_plus(m.group('password'))
         if not password:
             password = ''
-        pathdb = m.group('path')
+        pathdb = unquote_plus(m.group('path'))
         if not pathdb:
             raise SyntaxError, 'Path required'
-        charset = m.group('charset')
-        if not charset:
-            charset = 'UTF8'
+        charset = unquote_plus(m.group('charset') or 'UTF8')
         host = ''
         self.pool_connection(lambda host=host,
                              database=dbpath,
@@ -1527,16 +1527,16 @@
         if not m:
             raise SyntaxError, \
                 "Invalid URI string in DAL: %s" % self.uri
-        user = m.group('user')
+        user = unquote_plus(m.group('user'))
         if not user:
             raise SyntaxError, 'User required'
-        password = m.group('password')
+        password = unquote_plus(m.group('password'))
         if not password:
             password = ''
-        host = m.group('host')
+        host = unquote_plus(m.group('host'))
         if not host:
             raise SyntaxError, 'Host name required'
-        db = m.group('db')
+        db = unquote_plus(m.group('db'))
         if not db:
             raise SyntaxError, 'Database name required'
         self.pool_connection(lambda dsn='%s@%s' % (db,user), user=user,password=password:

