summaryrefslogtreecommitdiff
path: root/django/core/management/commands
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2012-12-08 11:13:52 +0100
committerClaude Paroz <claude@2xlibre.net>2012-12-08 11:13:52 +0100
commitc91667338a4e774e2819ccf4da852dc7b759bc19 (patch)
tree42a700d237c85ac2b647999d02d3dcd7d8047068 /django/core/management/commands
parent53b879f045f0e55cc8f4bedff67b5a14f3057561 (diff)
Fixed #19357 -- Allow non-ASCII chars in filesystem paths
Thanks kujiu for the report and Aymeric Augustin for the review.
Diffstat (limited to 'django/core/management/commands')
-rw-r--r--django/core/management/commands/compilemessages.py5
-rw-r--r--django/core/management/commands/loaddata.py5
-rw-r--r--django/core/management/commands/makemessages.py6
3 files changed, 9 insertions, 7 deletions
diff --git a/django/core/management/commands/compilemessages.py b/django/core/management/commands/compilemessages.py
index b7392b9173..e1d8a33332 100644
--- a/django/core/management/commands/compilemessages.py
+++ b/django/core/management/commands/compilemessages.py
@@ -5,6 +5,7 @@ import os
import sys
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
+from django.utils._os import npath
def has_bom(fn):
with open(fn, 'rb') as f:
@@ -41,8 +42,8 @@ def compile_messages(stderr, locale=None):
# command, so that we can take advantage of shell quoting, to
# quote any malicious characters/escaping.
# See http://cyberelk.net/tim/articles/cmdline/ar01s02.html
- os.environ['djangocompilemo'] = pf + '.mo'
- os.environ['djangocompilepo'] = pf + '.po'
+ os.environ['djangocompilemo'] = npath(pf + '.mo')
+ os.environ['djangocompilepo'] = npath(pf + '.po')
if sys.platform == 'win32': # Different shell-variable syntax
cmd = 'msgfmt --check-format -o "%djangocompilemo%" "%djangocompilepo%"'
else:
diff --git a/django/core/management/commands/loaddata.py b/django/core/management/commands/loaddata.py
index f6f1b1039a..ed47b8fbf1 100644
--- a/django/core/management/commands/loaddata.py
+++ b/django/core/management/commands/loaddata.py
@@ -13,6 +13,7 @@ from django.db import (connections, router, transaction, DEFAULT_DB_ALIAS,
IntegrityError, DatabaseError)
from django.db.models import get_apps
from django.utils.encoding import force_text
+from django.utils._os import upath
from itertools import product
try:
@@ -97,10 +98,10 @@ class Command(BaseCommand):
if hasattr(app, '__path__'):
# It's a 'models/' subpackage
for path in app.__path__:
- app_module_paths.append(path)
+ app_module_paths.append(upath(path))
else:
# It's a models.py module
- app_module_paths.append(app.__file__)
+ app_module_paths.append(upath(app.__file__))
app_fixtures = [os.path.join(os.path.dirname(path), 'fixtures') for path in app_module_paths]
diff --git a/django/core/management/commands/makemessages.py b/django/core/management/commands/makemessages.py
index 81c4fdf8cc..606cbe0b85 100644
--- a/django/core/management/commands/makemessages.py
+++ b/django/core/management/commands/makemessages.py
@@ -301,7 +301,7 @@ def make_messages(locale=None, domain='django', verbosity=1, all=False,
locales = []
if locale is not None:
- locales.append(locale)
+ locales.append(str(locale))
elif all:
locale_dirs = filter(os.path.isdir, glob.glob('%s/*' % localedir))
locales = [os.path.basename(l) for l in locale_dirs]
@@ -316,8 +316,8 @@ def make_messages(locale=None, domain='django', verbosity=1, all=False,
if not os.path.isdir(basedir):
os.makedirs(basedir)
- pofile = os.path.join(basedir, '%s.po' % domain)
- potfile = os.path.join(basedir, '%s.pot' % domain)
+ pofile = os.path.join(basedir, '%s.po' % str(domain))
+ potfile = os.path.join(basedir, '%s.pot' % str(domain))
if os.path.exists(potfile):
os.unlink(potfile)