Ticket #5743: ticket_5743__rev_6819.diff
File ticket_5743__rev_6819.diff, 3.8 KB (added by , 17 years ago) |
---|
-
django/conf/__init__.py
52 52 if not settings_module: # If it's set but is an empty string. 53 53 raise KeyError 54 54 except KeyError: 55 raise EnvironmentError, "Environment variable %s is undefined." % ENVIRONMENT_VARIABLE55 raise ImportError, "Environment variable %s is undefined so settings cannot be imported." % ENVIRONMENT_VARIABLE # NOTE: This is arguably an EnvironmentError, but that causes problems with Python's interactive help 56 56 57 57 self._target = Settings(settings_module) 58 58 … … 63 63 argument must support attribute access (__getattr__)). 64 64 """ 65 65 if self._target != None: 66 raise EnvironmentError, 'Settings already configured.'66 raise RuntimeError, 'Settings already configured.' 67 67 holder = UserSettingsHolder(default_settings) 68 68 for name, value in options.items(): 69 69 setattr(holder, name, value) … … 82 82 try: 83 83 mod = __import__(self.SETTINGS_MODULE, {}, {}, ['']) 84 84 except ImportError, e: 85 raise EnvironmentError, "Could not import settings '%s' (Is it on sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e)85 raise ImportError, "Could not import settings '%s' (Is it on sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e) 86 86 87 87 # Settings that should be converted into tuples if they're mistakenly entered 88 88 # as strings. -
django/core/management/__init__.py
84 84 try: 85 85 from django.conf import settings 86 86 apps = settings.INSTALLED_APPS 87 except (AttributeError, EnvironmentError):87 except (AttributeError, ImportError): 88 88 apps = [] 89 89 90 90 for app_name in apps: … … 99 99 try: 100 100 from django.conf import settings 101 101 project_directory = setup_environ(__import__(settings.SETTINGS_MODULE)) 102 except (AttributeError, EnvironmentError,ImportError):102 except (AttributeError, ImportError): 103 103 project_directory = None 104 104 105 105 if project_directory: -
django/newforms/fields.py
409 409 try: 410 410 from django.conf import settings 411 411 URL_VALIDATOR_USER_AGENT = settings.URL_VALIDATOR_USER_AGENT 412 except (ImportError, EnvironmentError):412 except ImportError: 413 413 # It's OK if Django settings aren't configured. 414 414 URL_VALIDATOR_USER_AGENT = 'Django (http://www.djangoproject.com/)' 415 415 -
docs/settings.txt
1166 1166 settings. 1167 1167 1168 1168 If you don't set ``DJANGO_SETTINGS_MODULE`` and don't call ``configure()``, 1169 Django will raise an `` EnvironmentError`` exception the first time a setting1170 is accessed. 1169 Django will raise an ``ImportError`` exception the first time a setting 1170 is accessed. 1171 1171 1172 1172 If you set ``DJANGO_SETTINGS_MODULE``, access settings values somehow, *then* 1173 call ``configure()``, Django will raise a n ``EnvironmentError`` saying settings1174 have already been configured.1173 call ``configure()``, Django will raise a ``RuntimeError`` indicating 1174 that settings have already been configured. 1175 1175 1176 1176 Also, it's an error to call ``configure()`` more than once, or to call 1177 1177 ``configure()`` after any setting has been accessed.