Changeset 6832
- Timestamp:
- 12/02/07 09:27:44 (7 months ago)
- Files:
-
- django/trunk/django/conf/__init__.py (modified) (3 diffs)
- django/trunk/django/core/management/__init__.py (modified) (2 diffs)
- django/trunk/django/newforms/fields.py (modified) (1 diff)
- django/trunk/docs/settings.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/conf/__init__.py
r6582 r6832 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) … … 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(): … … 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 django/trunk/django/core/management/__init__.py
r6718 r6832 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 … … 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 django/trunk/django/newforms/fields.py
r6785 r6832 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/)' django/trunk/docs/settings.txt
r6810 r6832 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 setting1169 Django will raise an ``ImportError`` exception the first time a setting 1170 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
