Skip to content
Permalink
Browse files

Merge pull request #4127 from arnaud-morvan/processing_fix_postgis_db…

…error

[processing] Fix infinite recursion in DbError.__str__
  • Loading branch information
alexbruy committed Feb 14, 2017
2 parents 3496871 + 5028cc7 commit 620ad4115018bed55b0bdb1812c3997ef8f896e7
Showing with 4 additions and 6 deletions.
  1. +4 −6 python/plugins/processing/tools/postgis.py
@@ -136,12 +136,9 @@ def __init__(self, message, query=None):
self.query = query

def __str__(self):
return str(self).encode('utf-8')

def __unicode__(self):
text = u'MESSAGE: %s' % self.message
text = "MESSAGE: {}".format(self.message)
if self.query:
text += u'\nQUERY: %s' % self.query
text = "{}\nQUERY: {}".format(text, self.query)
return text


@@ -829,7 +826,8 @@ def _exec_sql(self, cursor, sql):
try:
cursor.execute(sql)
except psycopg2.Error as e:
raise DbError(str(e), e.cursor.query)
raise DbError(str(e),
e.cursor.query.decode(e.cursor.connection.encoding))

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

0 comments on commit 620ad41

Please sign in to comment.
You can’t perform that action at this time.