Projet

Général

Profil

0002-jsonresponse-fix-exception-logging-for-exception-con.patch

Benjamin Dauvergne, 07 décembre 2017 14:25

Télécharger (1,61 ko)

Voir les différences:

Subject: [PATCH 2/2] jsonresponse: fix exception logging for exception
 containing unencoded UTF-8 (fixes #20498)

 passerelle/utils/jsonresponse.py | 2 +-
 tests/test_dummy.py              | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)
passerelle/utils/jsonresponse.py
126 126
                extras.update({'body': req.body})
127 127
            if (not isinstance(e, (Http404, PermissionDenied, ObjectDoesNotExist))
128 128
                    and getattr(e, 'log_error', True)):
129
                logger.exception("Error occurred while processing request", extra=extras)
129
                logger.exception(u"Error occurred while processing request", extra=extras)
130 130
            elif isinstance(e, ObjectDoesNotExist):
131 131
                logger.warning('object not found: %r', e, extra=extras)
132 132
            elif isinstance(e, PermissionDenied):
tests/test_dummy.py
19 19
                               resource_pk=conn.pk)
20 20
    return conn
21 21

  
22
@pytest.mark.xfail
23 22
def test_exception_with_utf8(app, dummy, mailoutbox, caplog):
24 23
    app.get('/dummy/dummy/exception_with_utf8/', status=500)
25 24
    assert u'Exception: é' in mailoutbox[0].body
26
-