NewsBlur/utils/djangologging/decorators.py
2009-07-19 17:10:54 +00:00

18 lines
No EOL
665 B
Python

from djangologging import SUPPRESS_OUTPUT_ATTR
def suppress_logging_output(func=None):
"""
Decorates a view to prevent any log messages generated by it (or anything
it calls) from being outputted to the browser.
"""
def decorated(*args, **kwargs):
response = func(*args, **kwargs)
setattr(response, SUPPRESS_OUTPUT_ATTR, True)
return response
return decorated
def supress_logging_output(func=None):
import warnings
warnings.warn('supress_logging_output is deprecated and will be removed soon; use the correctly spelled version instead: suppress_logging_output.')
return suppress_logging_output(func)