Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

All settings are now optional, and fallback to sensible defaults

  • Loading branch information...
commit f8e523e1034fb09e783a6fd12ccd7b2d7066bec6 1 parent 02fc747
@coderholic authored
Showing with 13 additions and 4 deletions.
  1. +13 −4 cities/conf.py
View
17 cities/conf.py
@@ -104,16 +104,24 @@ def create_settings():
res = type('',(),{})
res.files = files.copy()
- res.files.update(django_settings.CITIES_FILES)
+ if hasattr(django_settings, "CITIES_FILES"):
+ res.files.update(django_settings.CITIES_FILES)
- locales = django_settings.CITIES_LOCALES[:]
+ if hasattr(django_settings, "CITIES_LOCALES"):
+ locales = django_settings.CITIES_LOCALES[:]
+ else:
+ locales = ['en', 'und']
+
try:
locales.remove('LANGUAGES')
locales += [e[0] for e in django_settings.LANGUAGES]
except: pass
res.locales = set([e.lower() for e in locales])
- res.postal_codes = set([e.upper() for e in django_settings.CITIES_POSTAL_CODES])
+ if hasattr(django_settings, "CITIES_POSTAL_CODES"):
+ res.postal_codes = set([e.upper() for e in django_settings.CITIES_POSTAL_CODES])
+ else:
+ res.postal_codes = set()
return res
@@ -127,4 +135,5 @@ def create_plugins():
[settings.plugins[hook].append(obj) for hook in plugin_hooks if hasattr(obj,hook)]
settings = create_settings()
-create_plugins()
+if hasattr(django_settings, "CITIES_PLUGINS"):
+ create_plugins()
Please sign in to comment.
Something went wrong with that request. Please try again.