Test coverage report: ftp_deploy.utils.decorators

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

Generated: Thu 2013-12-19 21:13 GMT

Source file: /var/www/service.dev/service/ftp_deploy/utils/decorators.py

Stats: 11 executed, 0 missed, 0 excluded, 12 ignored

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