publisher: only handle non-encodable exception strings in python 2 (#36515)

This commit is contained in:
Frédéric Péters 2019-11-19 14:20:08 +01:00
parent 4b9c230141
commit 7b0978cf00
1 changed files with 2 additions and 1 deletions

View File

@ -183,7 +183,8 @@ class QommonPublisher(Publisher, object):
def _generate_plaintext_error(self, request, original_response,
exc_type, exc_value, tb, limit = None):
if exc_value:
if exc_value and six.PY2:
# do not fail on exception strings using non-ascii chars
exc_value = force_text(str(exc_value), errors='ignore').encode('ascii')
if not self.USE_LONG_TRACES:
if not request: