Commits

mattotodd  committed 0545344

throw exception if missing settings

  • Participants
  • Parent commits 26a2cfe

Comments (0)

Files changed (1)

File django_mobile_utils/__init__.py

 import re, os
 from django.conf import settings
 
+class ConfigurationException(Exception):pass
+
 DMU_PATH = os.path.dirname(__file__)
 
 #Settings
     'USE_REGEX':False                      # use RegEx to do the string search
 }
 """
-dmu_settings = settings.MOBILE_UTILS_SETTINGS
+dmu_settings = getattr(settings, 'MOBILE_UTILS_SETTINGS', None)
+if not dmu_settings:
+    raise ConfigurationException("settings file missing MOBILE_UTILS_SETTINGS")
 IGNORE_LIST = getattr(dmu_settings, 'IGNORE_LIST', ())
 MOBILE_TEMPLATES_DIR = getattr(dmu_settings, 'MOBILE_TEMPLATES_DIR', ())
 USE_REGEX = getattr(dmu_settings, 'USE_REGEX', False)