Skip to content

Commit a1ecd07

Browse files
committed
[1.1.X] Fixed #11284 - Stop forcing the use of the djangojs domain when the ".js" file extension is passed to makemessages management command. Thanks, Ramiro Morales.
Backport of r12439. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12450 bcc190cf-cafb-0310-a4f2-bffc1f526a37
1 parent a23edb6 commit a1ecd07

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

django/core/management/commands/makemessages.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from optparse import make_option
88

99
from django.core.management.base import CommandError, BaseCommand
10+
from django.utils.text import get_text_list
1011

1112
try:
1213
set
@@ -118,7 +119,7 @@ def make_messages(locale=None, domain='django', verbosity='1', all=False, extens
118119
all_files.sort()
119120
for dirpath, file in all_files:
120121
file_base, file_ext = os.path.splitext(file)
121-
if domain == 'djangojs' and file_ext == '.js':
122+
if domain == 'djangojs' and file_ext in extensions:
122123
if verbosity > 1:
123124
sys.stdout.write('processing file %s in %s\n' % (file, dirpath))
124125
src = open(os.path.join(dirpath, file), "rU").read()
@@ -221,14 +222,14 @@ def handle(self, *args, **options):
221222
domain = options.get('domain')
222223
verbosity = int(options.get('verbosity'))
223224
process_all = options.get('all')
224-
extensions = options.get('extensions') or ['html']
225+
extensions = options.get('extensions')
225226

226227
if domain == 'djangojs':
227-
extensions = []
228+
extensions = handle_extensions(extensions or ['js'])
228229
else:
229-
extensions = handle_extensions(extensions)
230+
extensions = handle_extensions(extensions or ['html'])
230231

231-
if '.js' in extensions:
232-
raise CommandError("JavaScript files should be examined by using the special 'djangojs' domain only.")
232+
if verbosity > 1:
233+
sys.stdout.write('examining files with the extensions: %s\n' % get_text_list(list(extensions), 'and'))
233234

234235
make_messages(locale, domain, verbosity, process_all, extensions)

0 commit comments

Comments
 (0)