Commit a1ecd073 authored by Jannis Leidel's avatar Jannis Leidel
Browse files

[1.1.X] Fixed #11284 - Stop forcing the use of the djangojs domain when the...

[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
parent a23edb64
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ from itertools import dropwhile
from optparse import make_option

from django.core.management.base import CommandError, BaseCommand
from django.utils.text import get_text_list

try:
    set
@@ -118,7 +119,7 @@ def make_messages(locale=None, domain='django', verbosity='1', all=False, extens
        all_files.sort()
        for dirpath, file in all_files:
            file_base, file_ext = os.path.splitext(file)
            if domain == 'djangojs' and file_ext == '.js':
            if domain == 'djangojs' and file_ext in extensions:
                if verbosity > 1:
                    sys.stdout.write('processing file %s in %s\n' % (file, dirpath))
                src = open(os.path.join(dirpath, file), "rU").read()
@@ -221,14 +222,14 @@ class Command(BaseCommand):
        domain = options.get('domain')
        verbosity = int(options.get('verbosity'))
        process_all = options.get('all')
        extensions = options.get('extensions') or ['html']
        extensions = options.get('extensions')

        if domain == 'djangojs':
            extensions = []
            extensions = handle_extensions(extensions or ['js'])
        else:
            extensions = handle_extensions(extensions)
            extensions = handle_extensions(extensions or ['html'])

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

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