Fix psycopg2 username/user confusion.

Make sure username is translated into the user when calling
psycopg2.connect. Also, fix the sample configuration files to use
username everywhere.
This commit is contained in:
Oleksii Kliukin
2016-02-10 10:26:22 +01:00
parent d426a795c3
commit 7ab366a735
+2
View File
@@ -132,6 +132,8 @@ class Postgresql:
if not self._connection or self._connection.closed != 0:
r = parseurl('postgres://{}/postgres'.format(self.local_address))
r.update(self.superuser)
if r.get('username'):
r['user'] = r['username']
self._connection = psycopg2.connect(**r)
self._connection.autocommit = True
self.server_version = self._connection.server_version