Do not try to process custom_css if none has be defined
authorgibus
Mon, 14 Jan 2013 10:43:21 +0100
changeset 483 65baad712962
parent 482 00f61fe2430a
child 484 5a8e83132898
Do not try to process custom_css if none has be defined
src/cm/views/texts.py
--- a/src/cm/views/texts.py	Fri Jan 11 16:51:16 2013 +0100
+++ b/src/cm/views/texts.py	Mon Jan 14 10:43:21 2013 +0100
@@ -256,11 +256,13 @@
     template_dict['json_filter_datas'] = jsonize(filter_datas, request)
     from cm.models import ApplicationConfiguration
     custom_css_str = ApplicationConfiguration.get_key('custom_css')
-    custom_css = cssutils.parseString(custom_css_str)
-    for css_rule in custom_css:
-      if css_rule.type == css_rule.STYLE_RULE and css_rule.wellformed:
-        css_rule.selectorText = "#textcontainer %s" %css_rule.selectorText
-    template_dict['custom_css'] = custom_css.cssText
+    if custom_css_str:
+      custom_css = cssutils.parseString(custom_css_str)
+      for css_rule in custom_css:
+        if css_rule.type == css_rule.STYLE_RULE and css_rule.wellformed:
+          css_rule.selectorText = "#textcontainer %s" %css_rule.selectorText
+      template_dict['custom_css'] = custom_css.cssText
+
     template_dict['custom_font'] = ApplicationConfiguration.get_key('custom_font')
     template_dict['custom_titles_font'] = ApplicationConfiguration.get_key('custom_titles_font')
     return render_to_response('site/text_view_comments.html',