minor changes for python3

This commit is contained in:
Alex Seeholzer 2015-11-18 10:41:02 +01:00
parent aae2501cab
commit 71504aa85d
2 changed files with 3 additions and 2 deletions

View File

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

View File

@ -29,7 +29,7 @@ class TestKBDisabled(TestCase):
self.assertRaises(NoReverseMatch, reverse, 'helpdesk_kb_index') self.assertRaises(NoReverseMatch, reverse, 'helpdesk_kb_index')
try: try:
response = self.client.get(reverse('helpdesk_dashboard')) response = self.client.get(reverse('helpdesk_dashboard'))
except NoReverseMatch, e: except NoReverseMatch as e:
if 'helpdesk_kb_index' in e.message: if 'helpdesk_kb_index' in e.message:
self.fail("Please verify any unchecked references to helpdesk_kb_index (start with navigation.html)") self.fail("Please verify any unchecked references to helpdesk_kb_index (start with navigation.html)")
else: else: