| 172 | |
| 173 | class ApplicationSettingsHolder(BaseSettings): |
| 174 | """ |
| 175 | Holder for application-specific settings. |
| 176 | """ |
| 177 | def __init__(self, application_settings): |
| 178 | """ |
| 179 | Requests for configuration variables first check the project_settings module |
| 180 | and falls back to application_settings if not found. |
| 181 | """ |
| 182 | try: |
| 183 | mod = importlib.import_module(application_settings) |
| 184 | except ImportError, e: |
| 185 | raise ImportError("Could not import application settings '%s': %s" % (application_settings, e)) |
| 186 | for setting in dir(mod): |
| 187 | if setting == setting.upper() and not hasattr(settings, setting.upper()): |
| 188 | setattr(self, setting, getattr(mod, setting)) |
| 189 | |
| 190 | def __getattr__(self, name): |
| 191 | return getattr(settings, name) |
| 192 | |
| 193 | |