mttransforms.py
changeset 7577 9892937d9041
parent 5611 55366f5b7a9f
child 10012 8c2c6fdd8d56
--- a/mttransforms.py	Wed Jun 29 16:13:09 2011 +0200
+++ b/mttransforms.py	Wed Jun 29 18:26:29 2011 +0200
@@ -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)