mirror of
https://github.com/open-telemetry/opentelemetry-python-contrib.git
synced 2025-07-28 12:43:39 +08:00
30 lines
654 B
Python
30 lines
654 B
Python
from webhelpers import * # noqa
|
|
|
|
|
|
class ExceptionWithCodeMethod(Exception):
|
|
"""Use case where the status code is defined by
|
|
the `code()` method.
|
|
"""
|
|
def __init__(self, message):
|
|
super(ExceptionWithCodeMethod, self).__init__(message)
|
|
|
|
def code():
|
|
pass
|
|
|
|
|
|
class AppGlobals(object):
|
|
"""Object used to store application globals."""
|
|
pass
|
|
|
|
|
|
def get_render_fn():
|
|
"""Re-import the function everytime so that double-patching
|
|
is correctly tested.
|
|
"""
|
|
try:
|
|
from pylons.templating import render_mako as render
|
|
except ImportError:
|
|
from pylons.templating import render
|
|
|
|
return render
|