old_contents: #!/usr/bin/env python
  # -*- coding: utf-8 -*-
  # The MIT License (MIT)
  # Copyright (c) 2015 Findspire
  
  import re
  from django.template import Library
  from django.conf import settings
  from workflow.apps.workflow.models import Item
  
  register = Library()
  
  
  @register.filter
  def get_tickets(value):
      tickets_id = re.findall(r'#([\d]+)', value)
      return [(settings.BUG_TRACKER_URL + ticket_id, ticket_id) for ticket_id in tickets_id]
  
  
  @register.filter
  def get_count(workflow, param):
      return workflow.get_count(param)
  
  
  @register.filter
  def percent(workflow, value):
      return (getattr(workflow, value) * 100.0) / workflow.total
  
  
  @register.filter
  def get_status(item):
      if item.validation == Item.VALIDATION_SUCCESS:
          return 'success'
      elif item.validation == Item.VALIDATION_UNTESTED:
          return 'untested'
      elif item.validation == Item.VALIDATION_FAILED:
          return 'failed'
  
      elif item.validation == Item.VALIDATION_DISABLED:
          return 'disabled'
  
  
  @register.filter
  def u(s):
      if isinstance(s, unicode):
          return s.encode('utf-8', errors='ignore')
      return s
  
new_contents: #!/usr/bin/env python
  # -*- coding: utf-8 -*-
  # The MIT License (MIT)
  # Copyright (c) 2015 Findspire
  
  import re
  from django.template import Library
  from django.conf import settings
  from workflow.apps.workflow.models import Item
  
  register = Library()
  
  
  @register.filter
  def get_tickets(value):
      tickets_id = re.findall(r'#([\d]+)', value)
      return [(settings.BUG_TRACKER_URL + ticket_id, ticket_id) for ticket_id in tickets_id]
  
  
  @register.filter
  def get_count(workflow, param):
      return workflow.get_count(param)
  
  
  @register.filter
  def percent(workflow, value):
      return (getattr(workflow, value) * 100.0) / workflow.total if workflow.total != 0 else 100
  
  
  @register.filter
  def get_status(item):
      if item.validation == Item.VALIDATION_SUCCESS:
          return 'success'
      elif item.validation == Item.VALIDATION_UNTESTED:
          return 'untested'
      elif item.validation == Item.VALIDATION_FAILED:
          return 'failed'
  
      elif item.validation == Item.VALIDATION_DISABLED:
          return 'disabled'
  
  
  @register.filter
  def u(s):
      if isinstance(s, unicode):
          return s.encode('utf-8', errors='ignore')
      return s
  
subject: fix zero division error