Skip to content
Browse files
[PROCESSING] [regression] One more fix for broken encoding of psycopg…
…2 error messages
  • Loading branch information
borysiasty committed Jun 3, 2017
1 parent 0b76352 commit 2c8e03de391ac8a878d56e0a491c6a70b7a4c589
Showing with 2 additions and 2 deletions.
  1. +2 −2 python/plugins/processing/tools/
@@ -205,7 +205,7 @@ def __init__(self, host=None, port=None, dbname=None, user=None,
except psycopg2.OperationalError as e:
if i == 3:
raise DbError(unicode(e))

This comment has been minimized.

Copy link

m-kuhn Jun 3, 2017


Can't the unicode conversion simply be dropped? The less casting, the less information loss.

This comment has been minimized.

Copy link

borysiasty Jul 11, 2017

Author Member

AFAIR, nope - the ascii codec would be used for further processing the message.

raise DbError(unicode(e.pgerror, e.cursor.connection.encoding, 'replace'))

err = unicode(e)
user = self.uri.username()
@@ -821,7 +821,7 @@ def _exec_sql(self, cursor, sql):
except psycopg2.Error as e:
raise DbError(unicode(e), e.cursor.query)
raise DbError(unicode(e.pgerror, e.cursor.connection.encoding, 'replace'), e.cursor.query)

def _exec_sql_and_commit(self, sql):
"""Tries to execute and commit some action, on error it rolls

0 comments on commit 2c8e03d

Please sign in to comment.