Created
May 20, 2015 15:26
-
-
Save gcarothers/874b9df262dd2b20fcde to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@view_config(context=Exception) | |
def exception_view(context, request): | |
# Check to see if debug toolbar is enabled. | |
from pyramid.interfaces import ITweens | |
tweens = request.registry.queryUtility(ITweens) | |
if tweens: | |
tween_list = tweens.explicit or tweens.implicit() | |
tween_names = zip(*tween_list)[0] | |
if tween_list and 'pyramid_debugtoolbar.toolbar_tween_factory' in\ | |
tween_names: | |
raise # Re-raise exception for debug toolbar. | |
# Exception handler goes here ;) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment