ftp_deploy.utils.decorators: 11 total statements, 100.0% covered

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

  1. class check(object):
  2. """
  3. Wrap function in try/except
  4. Return True with error message (with prefix) if raise Exception, otherwise return False and empty string
  5. """
  6. def __init__(self, prefix):
  7. self.prefix = prefix
  8. def __call__(self, fn):
  9. def wrapped(*args):
  10. try:
  11. fn(*args)
  12. except Exception, e:
  13. return True, '<b>%s:</b> %s' % (self.prefix, e)
  14. else:
  15. return False, ''
  16. return wrapped