1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

[1.7.x] Fixed #22564 -- Prevented unneeded bytestrings in migrations

In some cases, this could lead to migrations written with Python 2
being incompatible with Python 3.
Thanks Tim Graham for the report and Loïc Bistuer for the advices.
Backport of da9cf53cb from master.
This commit is contained in:
Claude Paroz
2014-05-05 20:39:26 +02:00
parent e8f1395f4e
commit 0d138b9cf4
4 changed files with 11 additions and 5 deletions

View File

@@ -124,6 +124,8 @@ class MigrationWriter(object):
dependencies.append(" migrations.swappable_dependency(settings.%s)," % dependency[1])
imports.add("from django.conf import settings")
else:
# No need to output bytestrings for dependencies
dependency = tuple([force_text(s) for s in dependency])
dependencies.append(" %s," % self.serialize(dependency)[0])
items["dependencies"] = "\n".join(dependencies) + "\n" if dependencies else ""