Skip to content

Commit

Permalink
Fixed invalid URL parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
pcdinh committed Jan 16, 2013
1 parent bc5f31d commit 8d73c4c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions nomad/engine/dbapi.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def path2dict(p, **renames):
'''Convert urlparse result to dict '''Convert urlparse result to dict
''' '''
result = {} result = {}
for k in 'hostname port path user password'.split(): for k in 'hostname port path username password'.split():
value = getattr(p, k, None) value = getattr(p, k, None)
if not value: if not value:
continue continue
Expand Down Expand Up @@ -73,7 +73,7 @@ class Mysql(Connection):
_conn = None _conn = None
def __init__(self, path): def __init__(self, path):
self.parameters = path2dict(path, hostname='host', self.parameters = path2dict(path, hostname='host',
password='passwd', path='db') password='passwd', path='db', username='user')
import MySQLdb import MySQLdb
self.module = MySQLdb self.module = MySQLdb
self.exc = MySQLdb.MySQLError self.exc = MySQLdb.MySQLError
Expand All @@ -100,7 +100,7 @@ def rollback(self):
class Pgsql(Connection): class Pgsql(Connection):
_conn = None _conn = None
def __init__(self, path): def __init__(self, path):
self.parameters = path2dict(path, hostname='host', path='database') self.parameters = path2dict(path, hostname='host', path='database', username='user')
import psycopg2 import psycopg2
self.module = psycopg2 self.module = psycopg2
self.exc = psycopg2.Error self.exc = psycopg2.Error
Expand Down

0 comments on commit 8d73c4c

Please sign in to comment.