Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #11284 - Stop forcing the use of the djangojs domain when the "…

….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...
commit 9b630a08572031f657fda18dae33d9a7567d4f28 1 parent 33a225c
Jannis Leidel authored February 16, 2010
13  django/core/management/commands/makemessages.py
@@ -7,6 +7,7 @@
7 7
 from subprocess import PIPE, Popen
8 8
 
9 9
 from django.core.management.base import CommandError, BaseCommand
  10
+from django.utils.text import get_text_list
10 11
 
11 12
 pythonize_re = re.compile(r'\n\s*//')
12 13
 
@@ -108,7 +109,7 @@ def make_messages(locale=None, domain='django', verbosity='1', all=False, extens
108 109
         all_files.sort()
109 110
         for dirpath, file in all_files:
110 111
             file_base, file_ext = os.path.splitext(file)
111  
-            if domain == 'djangojs' and file_ext == '.js':
  112
+            if domain == 'djangojs' and file_ext in extensions:
112 113
                 if verbosity > 1:
113 114
                     sys.stdout.write('processing file %s in %s\n' % (file, dirpath))
114 115
                 src = open(os.path.join(dirpath, file), "rU").read()
@@ -200,14 +201,14 @@ def handle(self, *args, **options):
200 201
         domain = options.get('domain')
201 202
         verbosity = int(options.get('verbosity'))
202 203
         process_all = options.get('all')
203  
-        extensions = options.get('extensions') or ['html']
  204
+        extensions = options.get('extensions')
204 205
 
205 206
         if domain == 'djangojs':
206  
-            extensions = []
  207
+            extensions = handle_extensions(extensions or ['js'])
207 208
         else:
208  
-            extensions = handle_extensions(extensions)
  209
+            extensions = handle_extensions(extensions or ['html'])
209 210
 
210  
-        if '.js' in extensions:
211  
-            raise CommandError("JavaScript files should be examined by using the special 'djangojs' domain only.")
  211
+        if verbosity > 1:
  212
+            sys.stdout.write('examining files with the extensions: %s\n' % get_text_list(list(extensions), 'and'))
212 213
 
213 214
         make_messages(locale, domain, verbosity, process_all, extensions)

0 notes on commit 9b630a0

Please sign in to comment.
Something went wrong with that request. Please try again.