fixes of python 3 test fails

This commit is contained in:
Alex Seeholzer 2015-11-18 15:07:33 +01:00
parent 71504aa85d
commit 8390125c01
3 changed files with 6 additions and 6 deletions

View File

@ -21,7 +21,6 @@ import logging
logger = logging.getLogger('helpdesk')
from django.utils.encoding import smart_str
from builtins import str as text
def send_templated_mail(template_name, email_context, recipients, sender=None, bcc=None, fail_silently=False, files=None):
"""
@ -119,7 +118,7 @@ def send_templated_mail(template_name, email_context, recipients, sender=None, b
"subject": t.subject,
}).render(context)
if isinstance(recipients, text):
if isinstance(recipients, str):
if recipients.find(','):
recipients = recipients.split(',')
elif type(recipients) != list:

View File

@ -22,6 +22,9 @@ def get_staff_user(username='helpdesk.staff', password='password'):
def reload_urlconf(urlconf=None):
from imp import reload # python 3 needs this import.
if urlconf is None:
from django.conf import settings

View File

@ -1080,7 +1080,7 @@ def run_report(request, report):
)
except QueueMembership.DoesNotExist:
queue_options = queue_options.none()
possible_options = [q.title.encode('utf-8') for q in queue_options]
possible_options = [q.title for q in queue_options]
charttype = 'bar'
elif report == 'userstatus':
@ -1155,20 +1155,18 @@ def run_report(request, report):
metric3 = ticket.modified - ticket.created
metric3 = metric3.days
summarytable[metric1, metric2] += 1
if metric3:
if report == 'daysuntilticketclosedbymonth':
summarytable2[metric1, metric2] += metric3
table = []
if report == 'daysuntilticketclosedbymonth':
for key in summarytable2.keys():
summarytable[key] = summarytable2[key] / summarytable[key]
header1 = sorted(set(list( i.encode('utf-8') for i,_ in summarytable.keys() )))
header1 = sorted(set(list(i for i, _ in summarytable.keys())))
column_headings = [col1heading] + possible_options