Commits

David Chambers  committed 76dd9f2

Refactored "stylesheets" code to match neighbouring "scripts" code.

  • Participants
  • Parent commits d0ca71c

Comments (0)

Files changed (1)

 from django.template import RequestContext, loader
 from django.template.defaultfilters import slugify
 
-import mango
 from mango.settings import *
 from mango.exceptions import EmptySettingError
 from mango.forms import CommentForm, ContactForm
     context['posts'] = toplevel.descendants()
     context['tags'] = toplevel.tags()
 
-    # stylesheets
-    css = getattr(mango.settings, 'CSS', ())
-    context['stylesheets'] = []
-    for media, css_files in css[1:]:
-        for filename in css_files:
-            stylesheet = {'media': media, 'href': css[0] + filename}
-            context['stylesheets'].append(stylesheet)
-
-    # scripts
+    try:
+        CSS
+    except NameError:
+        context['stylesheets'] = []
+    else:
+        context['stylesheets'] = []
+        for media, filenames in CSS[1:]:
+            for filename in filenames:
+                stylesheet = {'media': media, 'href': CSS[0] + filename}
+                context['stylesheets'].append(stylesheet)
     try:
         JS
     except NameError: