Generated: Sun 2014-03-16 19:26 GMT
Source file: /var/www/service.dev/service/ftp_deploy/utils/decorators.py
Stats: 11 executed, 0 missed, 0 excluded, 12 ignored
class check(object):
"""
Wrap function in try/except
Return True with error message (with prefix) if raise Exception, otherwise return False and empty string
"""
def __init__(self, prefix):
self.prefix = prefix
def __call__(self, fn):
def wrapped(*args):
try:
fn(*args)
except Exception, e:
return True, '<b>%s:</b> %s' % (self.prefix, e)
else:
return False, ''
return wrapped