|
a/Allura/allura/lib/utils.py |
|
b/Allura/allura/lib/utils.py |
|
... |
|
... |
3 |
from logging.handlers import WatchedFileHandler
|
3 |
from logging.handlers import WatchedFileHandler
|
4 |
|
4 |
|
5 |
import tg
|
5 |
import tg
|
6 |
from pylons import response
|
6 |
from pylons import response
|
7 |
from paste.httpheaders import CACHE_CONTROL, EXPIRES
|
7 |
from paste.httpheaders import CACHE_CONTROL, EXPIRES
|
|
|
8 |
|
8 |
from ming.utils import LazyProperty
|
9 |
from ming.utils import LazyProperty
|
9 |
|
10 |
|
10 |
class exceptionless(object):
|
11 |
class exceptionless(object):
|
11 |
'''Decorator making the decorated function return 'error_result' on any
|
12 |
'''Decorator making the decorated function return 'error_result' on any
|
12 |
exceptions rather than propagating exceptions up the stack
|
13 |
exceptions rather than propagating exceptions up the stack
|
|
... |
|
... |
104 |
record.kwpairs = ','.join(
|
105 |
record.kwpairs = ','.join(
|
105 |
'%s=%s' % (k,v) for k,v in sorted(kwpairs.iteritems())
|
106 |
'%s=%s' % (k,v) for k,v in sorted(kwpairs.iteritems())
|
106 |
if v is not None)
|
107 |
if v is not None)
|
107 |
record.exc_info = None # Never put tracebacks in the rtstats log
|
108 |
record.exc_info = None # Never put tracebacks in the rtstats log
|
108 |
WatchedFileHandler.emit(self, record)
|
109 |
WatchedFileHandler.emit(self, record)
|
109 |
|
110 |
|
|
|
111 |
def task(func):
|
|
|
112 |
'''Decorator to add some methods to task functions'''
|
|
|
113 |
def post(*args, **kwargs):
|
|
|
114 |
from allura import model as M
|
|
|
115 |
return M.MonQTask.post(func, *args, **kwargs)
|
|
|
116 |
func.post = post
|
|
|
117 |
return func
|