From 6004fe9573e053faf3fc44bd895cc08c6e848267 Mon Sep 17 00:00:00 2001 From: Georg Bauer Date: Fri, 11 Nov 2005 23:34:08 +0000 Subject: [PATCH] fix a problem that masks errors in settings files for some users - in those cases you only got "INSTALLED_APPS not defined", but in reality your settings file was broken. git-svn-id: http://code.djangoproject.com/svn/django/trunk@1185 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/bin/django-admin.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/django/bin/django-admin.py b/django/bin/django-admin.py index c66d195ae53..e08eeccb703 100755 --- a/django/bin/django-admin.py +++ b/django/bin/django-admin.py @@ -3,14 +3,6 @@ from django.core import management from optparse import OptionParser import os, sys -# switch to english, because django-admin creates database content -# like permissions, and those shouldn't contain any translations -try: - from django.utils import translation - translation.activate('en-us') -except: - pass - ACTION_MAPPING = { 'adminindex': management.get_admin_index, 'createsuperuser': management.createsuperuser, @@ -80,6 +72,14 @@ def main(): parser.print_usage_and_exit() if not ACTION_MAPPING.has_key(action): print_error("Your action, %r, was invalid." % action, sys.argv[0]) + + # switch to english, because django-admin creates database content + # like permissions, and those shouldn't contain any translations. + # But only do this if we should have a working settings file. + if action not in ('startproject', 'startapp'): + from django.utils import translation + translation.activate('en-us') + if action in ('createsuperuser', 'init', 'validate'): ACTION_MAPPING[action]() elif action == 'inspectdb':