From 119f33ed34cb7f6a95077106a7c667f2ca17f23d Mon Sep 17 00:00:00 2001 From: Bernhard Weitzhofer Date: Fri, 3 May 2013 21:31:20 +0200 Subject: [PATCH] postgresql_privs: fix wrong codec specification Use psycopg2's mapping from PostgreSQL encoding names to Python codec names. --- library/database/postgresql_privs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/database/postgresql_privs b/library/database/postgresql_privs index 5013f11776..13ff09062b 100644 --- a/library/database/postgresql_privs +++ b/library/database/postgresql_privs @@ -224,6 +224,7 @@ postgresql_privs: > try: import psycopg2 + import psycopg2.extensions except ImportError: psycopg2 = None @@ -266,7 +267,8 @@ class Connection(object): @property def encoding(self): - return self.connection.encoding + """Connection encoding in Python-compatible form""" + return psycopg2.extensions.encodings[self.connection.encoding] ### Methods for querying database objects