diff roundup/cgi/templating.py @ 6102:0a82437a2930

make sure to use the right deregister api so it works for older versions
author Christof Meerwald <cmeerw@cmeerw.org>
date Tue, 25 Feb 2020 16:36:18 +0000
parents d4ce26b14cf5
children af16c135fb98
line wrap: on
line diff
--- a/roundup/cgi/templating.py	Tue Feb 25 16:35:10 2020 +0000
+++ b/roundup/cgi/templating.py	Tue Feb 25 16:36:18 2020 +0000
@@ -79,8 +79,14 @@
         # make sure any HTML tags get escaped
         class EscapeHtml(MarkdownExtension):
             def extendMarkdown(self, md, md_globals=None):
-                md.preprocessors.deregister('html_block')
-                md.inlinePatterns.deregister('html')
+                if hasattr(md.preprocessors, 'deregister'):
+                    md.preprocessors.deregister('html_block')
+                else:
+                    del md.preprocessors['html_block']
+                if hasattr(md.inlinePatterns, 'deregister'):
+                    md.inlinePatterns.deregister('html')
+                else:
+                    del md.inlinePatterns['html']
 
         markdown = lambda s: markdown_impl(s, extensions=[EscapeHtml(), 'fenced_code'])
     except ImportError:

Roundup Issue Tracker: http://roundup-tracker.org/