Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #7643 -- Fixed an oversight from [7844].

Now makemessages works in projects again. Based on a patch from Horst Gutmann.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7848 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 25f2cfb7cbce2ea1e7547a55b01d16896039c44b 1 parent 075098f
Malcolm Tredinnick authored July 06, 2008
7  django/conf/__init__.py
@@ -71,6 +71,13 @@ def configure(self, default_settings=global_settings, **options):
71 71
             setattr(holder, name, value)
72 72
         self._target = holder
73 73
 
  74
+    def configured(self):
  75
+        """
  76
+        Returns True if the settings have already been configured.
  77
+        """
  78
+        return bool(self._target)
  79
+    configured = property(configured)
  80
+
74 81
 class Settings(object):
75 82
     def __init__(self, settings_module):
76 83
         # update this dict from global settings (but only for ALL_CAPS settings)
11  django/core/management/commands/makemessages.py
@@ -10,12 +10,15 @@
10 10
 def make_messages(locale=None, domain='django', verbosity='1', all=False):
11 11
     """
12 12
     Uses the locale directory from the Django SVN tree or an application/
13  
-    project to process all 
  13
+    project to process all
14 14
     """
15 15
     # Need to ensure that the i18n framework is enabled
16 16
     from django.conf import settings
17  
-    settings.configure(USE_I18N = True)
18  
-    
  17
+    if settings.configured:
  18
+        settings.USE_I18N = True
  19
+    else:
  20
+        settings.configure(USE_I18N = True)
  21
+
19 22
     from django.utils.translation import templatize
20 23
 
21 24
     if os.path.isdir(os.path.join('conf', 'locale')):
@@ -24,7 +27,7 @@ def make_messages(locale=None, domain='django', verbosity='1', all=False):
24 27
         localedir = os.path.abspath('locale')
25 28
     else:
26 29
         raise CommandError("This script should be run from the Django SVN tree or your project or app tree. If you did indeed run it from the SVN checkout or your project or application, maybe you are just missing the conf/locale (in the django tree) or locale (for project and application) directory? It is not created automatically, you have to create it by hand if you want to enable i18n for your project or application.")
27  
-    
  30
+
28 31
     if domain not in ('django', 'djangojs'):
29 32
         raise CommandError("currently makemessages only supports domains 'django' and 'djangojs'")
30 33
 

0 notes on commit 25f2cfb

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