DIRTY path to fix it and add "port":
diff --git a/web/db.py b/web/db.py
index a51fa7a..66b7cf1 100644
--- a/web/db.py
+++ b/web/db.py
@@ -1139,13 +1139,23 @@ def dburl2dict(url):
{'user': 'james', 'host': 'serverfarm.example.net', 'db':
'mygreatdb', 'pw': 'day', 'dbn': 'postgres'}
"""
+ import re
dbn, rest = url.split('://', 1)
user, rest = rest.split(':', 1)
- pw, rest = rest.split('@', 1)
+ user = re.sub("""['"]""", '', user)
+ if rest.startswith('"'):
+ pw, rest = rest.split('"', 2)[1:]
+ rest = rest.split('@', 1)[1]
+ elif rest.startswith("'"):
+ pw, rest = rest.split("'", 2)[1:]
+ rest = rest.split('@', 1)[1]
+ else:
+ pw, rest = rest.split('@', 1)
+
host, rest = rest.split(':', 1)
port, rest = rest.split('/', 1)
db = rest
- return dict(dbn=dbn, user=user, pw=pw, db=db, host=host)
+ return dict(dbn=dbn, user=user, pw=pw, db=db, host=host, port=port)
_databases = {}
def database(dburl=None, **params):
--
You received this message because you are subscribed to the Google Groups
"web.py" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/webpy/-/lTC88sXjMMkJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/webpy?hl=en.