Projet

Général

Profil

0001-misc-add-settings-to-propagate-exceptions-in-hooks-4.patch

Benjamin Dauvergne, 16 mai 2020 11:38

Télécharger (1,49 ko)

Voir les différences:

Subject: [PATCH 1/2] misc: add settings to propagate exceptions in hooks
 (#42982)

 src/authentic2/hooks.py | 4 ++++
 tests/settings.py       | 2 ++
 2 files changed, 6 insertions(+)
src/authentic2/hooks.py
54 54
        try:
55 55
            yield hook(*args, **kwargs)
56 56
        except Exception:
57
            if getattr(settings, 'A2_HOOKS_PROPAGATE_EXCEPTIONS', False):
58
                raise
57 59
            logger.exception(u'exception while calling hook %s', hook)
58 60

  
59 61

  
......
67 69
            if result is not None:
68 70
                return result
69 71
        except Exception:
72
            if getattr(settings, 'A2_HOOKS_PROPAGATE_EXCEPTIONS', False):
73
                raise
70 74
            logger.exception(u'exception while calling hook %s', hook)
tests/settings.py
45 45

  
46 46
A2_VALIDATE_EMAIL_DOMAIN = False
47 47

  
48
A2_HOOKS_PROPAGATE_EXCEPTIONS = True
49

  
48 50
TEMPLATES[0]['DIRS'].append('tests/templates')
49 51
TEMPLATES[0]['OPTIONS']['debug'] = True
50 52

  
51
-