Permalink
Browse files

Add get_setting_or_die utility

  • Loading branch information...
1 parent 7b83dcf commit a59267b09d8cc5c0a87caa5396ff1ac4dc4ebd35 @idan committed Jun 5, 2012
Showing with 9 additions and 0 deletions.
  1. 0 telostats/utils/__init__.py
  2. +9 −0 telostats/utils/settings.py
No changes.
@@ -0,0 +1,9 @@
+from django.conf import settings
+from django.core.exceptions import ImproperlyConfigured
+
+
+def get_setting_or_die(setting):
+ try:
+ return getattr(settings, setting)
+ except AttributeError:
+ raise ImproperlyConfigured('No setting named "{0}" was found in settings.py.'.format(setting))

0 comments on commit a59267b

Please sign in to comment.