Test coverage report: ftp_deploy.server.templatetags.active_tag

# ftp_deploy.server.templatetags.active_tag: 14 total statements, 100.0% covered

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

Source file: /var/www/service.dev/service/ftp_deploy/server/templatetags/active_tag.py

Stats: 10 executed, 0 missed, 4 excluded, 5 ignored

1. `import re`
2. ``
3. `from django import template`
4. `from django.conf import settings`
5. `from django.core.urlresolvers import reverse, NoReverseMatch`
6. ``
7. `register = template.Library()`
8. ``
9. `@register.simple_tag(takes_context=True)`
10. `def active(context, pattern_or_urlname):`
11. `"""Tag provide active class for menu elements"""`
12. `try:`
13. `pattern = '^' + reverse(pattern_or_urlname)`
14. `except NoReverseMatch:`
15. `pattern = pattern_or_urlname`
16. `path = context['request'].path`
17. `if re.search(pattern, path):`
18. `return 'active'`
19. `return ''`