1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

Refs #24324 -- Fixed UnicodeDecodeError in MigrationWriter on Python 2.

This commit is contained in:
Tim Graham 2015-02-17 18:48:15 -05:00
parent bebc1e53a3
commit fa66ea7532

View File

@ -228,11 +228,11 @@ class MigrationWriter(object):
# In case of using MIGRATION_MODULES setting and the custom # In case of using MIGRATION_MODULES setting and the custom
# package doesn't exist, create one. # package doesn't exist, create one.
package_dirs = migrations_package_name.split(".") package_dirs = migrations_package_name.split(".")
create_path = os.path.join(sys.path[0], *package_dirs) create_path = os.path.join(upath(sys.path[0]), *package_dirs)
if not os.path.isdir(create_path): if not os.path.isdir(create_path):
os.makedirs(create_path) os.makedirs(create_path)
for i in range(1, len(package_dirs) + 1): for i in range(1, len(package_dirs) + 1):
init_dir = os.path.join(sys.path[0], *package_dirs[:i]) init_dir = os.path.join(upath(sys.path[0]), *package_dirs[:i])
init_path = os.path.join(init_dir, "__init__.py") init_path = os.path.join(init_dir, "__init__.py")
if not os.path.isfile(init_path): if not os.path.isfile(init_path):
open(init_path, "w").close() open(init_path, "w").close()