Browse Source

Fail in template instead of context processor

Ralfp 12 years ago
parent
commit
eb91909439
1 changed files with 10 additions and 6 deletions
  1. 10 6
      misago/context_processors.py

+ 10 - 6
misago/context_processors.py

@@ -1,9 +1,13 @@
 from misago import __version__
 from misago import __version__
 
 
 def misago(request):
 def misago(request):
-    return {
-        'version': __version__,
-        'monitor': request.monitor,
-        'settings': request.settings,
-        'stopwatch': request.stopwatch.time(),
-    }
+    try:
+        return {
+            'version': __version__,
+            'monitor': request.monitor,
+            'settings': request.settings,
+            'stopwatch': request.stopwatch.time(),
+        }
+    except AttributeError:
+        # If request lacks required service, let template crash in context processor's stead
+        return  {}