Commits

Boaz Leskes  committed bc3e1a2

Added a protection against not existing FANSTATIC_CONFIG in settings.py as we have defaults anyway.

  • Participants
  • Parent commits be64344

Comments (0)

Files changed (1)

File src/django_fanstatic/middleware.py

         config = dict()
 
         from django.conf import settings
-        config.update(settings.FANSTATIC_CONFIG)
+        try:
+            config.update(settings.FANSTATIC_CONFIG)
+        except AttributeError:
+            pass
 
         # this is just to give useful feedback early on
         fanstatic.NeededResources(**config)
 
         self.publisher = fanstatic.Publisher(fanstatic.get_library_registry())
 
-        self.publisher_signature = "/"+ settings.FANSTATIC_CONFIG.get("publisher_signature",fanstatic.DEFAULT_SIGNATURE) +"/"
+        signature = None
+        try:
+            signature = settings.FANSTATIC_CONFIG.get("publisher_signature")
+        except AttributeError:
+            pass
+
+        if signature is None: signature = fanstatic.DEFAULT_SIGNATURE
+        self.publisher_signature = "/"+ signature +"/"