mttransforms.py
brancholdstable
changeset 8123 a4e667270dd4
parent 7577 9892937d9041
child 10012 8c2c6fdd8d56
--- a/mttransforms.py	Mon Sep 26 18:37:23 2011 +0200
+++ b/mttransforms.py	Fri Dec 09 12:08:27 2011 +0100
@@ -99,10 +99,10 @@
 
     def patch_convert(cls):
         def _convert(self, trdata, origconvert=cls._convert):
-            try:
-                trdata.appobject._cw.add_css('pygments.css')
-            except AttributeError: # session has no add_css, only http request
-                pass
+            add_css = getattr(trdata.appobject._cw, 'add_css', None)
+            if add_css is not None:
+                # session has no add_css, only http request
+                add_css('pygments.css')
             return origconvert(self, trdata)
         cls._convert = _convert
     patch_convert(pygmentstransforms.PygmentsHTMLTransform)