Skip to content

Commit

Permalink
Fixed #11284 - Stop forcing the use of the djangojs domain when the "…
Browse files Browse the repository at this point in the history
….js" file extension is passed to makemessages management command. Thanks, Ramiro Morales.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12439 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
jezdez committed Feb 16, 2010
1 parent 33a225c commit 9b630a0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions django/core/management/commands/makemessages.py
Expand Up @@ -7,6 +7,7 @@
from subprocess import PIPE, Popen from subprocess import PIPE, Popen


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


pythonize_re = re.compile(r'\n\s*//') pythonize_re = re.compile(r'\n\s*//')


Expand Down Expand Up @@ -108,7 +109,7 @@ def make_messages(locale=None, domain='django', verbosity='1', all=False, extens
all_files.sort() all_files.sort()
for dirpath, file in all_files: for dirpath, file in all_files:
file_base, file_ext = os.path.splitext(file) 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: if verbosity > 1:
sys.stdout.write('processing file %s in %s\n' % (file, dirpath)) sys.stdout.write('processing file %s in %s\n' % (file, dirpath))
src = open(os.path.join(dirpath, file), "rU").read() src = open(os.path.join(dirpath, file), "rU").read()
Expand Down Expand Up @@ -200,14 +201,14 @@ def handle(self, *args, **options):
domain = options.get('domain') domain = options.get('domain')
verbosity = int(options.get('verbosity')) verbosity = int(options.get('verbosity'))
process_all = options.get('all') process_all = options.get('all')
extensions = options.get('extensions') or ['html'] extensions = options.get('extensions')


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


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


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

0 comments on commit 9b630a0

Please sign in to comment.