diff --git a/django_future_url/core.py b/django_future_url/core.py index 482552a..5d3a60e 100755 --- a/django_future_url/core.py +++ b/django_future_url/core.py @@ -88,11 +88,11 @@ def make_me_magic(write): if has_deprecated_tag(file_content): found = True log.info(file_path.replace(CURRENT_PATH + '/', '')) - new_content = parse_file(file_content) + new_content = parse_file(file_content.decode('utf-8')) if write: t_file.seek(0) - t_file.write(new_content) + t_file.write(new_content.encode('utf-8')) log.info(' File updated') if not found: diff --git a/django_future_url/test/test_core.py b/django_future_url/test/test_core.py index afa3cf2..ce4f247 100644 --- a/django_future_url/test/test_core.py +++ b/django_future_url/test/test_core.py @@ -2,6 +2,7 @@ import os import subprocess import unittest +from django_future_url import core from django_future_url.core import parse_file @@ -32,4 +33,7 @@ def test_deprecated_urls_false_load(self): self.assertTemplateFixed('deprecated_urls_false_load') def test_should_not_be_upgraded(self): - self.assertTemplateFixed('should_not_be_upgraded') \ No newline at end of file + self.assertTemplateFixed('should_not_be_upgraded') + + def test_make_me_magic(self): + core.make_me_magic(write=False) \ No newline at end of file diff --git a/django_future_url/test/test_project/templates/bad_chars.html b/django_future_url/test/test_project/templates/bad_chars.html new file mode 100644 index 0000000..7d7dd5f --- /dev/null +++ b/django_future_url/test/test_project/templates/bad_chars.html @@ -0,0 +1,23 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block left_slot %} + +{% endblock %} + +{% block content %} +
+ {{competitor.title}} +
+ +
+ {{form.errors}} +
{% csrf_token %} + {{form.as_p}} + +
+
+ +{% endblock %}