comparison roundup/cgi/templating.py @ 6275:bda491248fd8

Handle exception raised from markdown processing If an exception is raised from the markdown processor, return plain text to the user.
author John Rouillard <rouilj@ieee.org>
date Thu, 22 Oct 2020 20:43:29 -0400
parents af372b9372f6
children 957a0fc20021
comparison
equal deleted inserted replaced
6274:474de62f4ce0 6275:bda491248fd8
1728 if not markdown: 1728 if not markdown:
1729 return self.plain(escape=0, hyperlink=hyperlink) 1729 return self.plain(escape=0, hyperlink=hyperlink)
1730 s = self.plain(escape=0, hyperlink=0) 1730 s = self.plain(escape=0, hyperlink=0)
1731 if hyperlink: 1731 if hyperlink:
1732 s = self.hyper_re.sub(self._hyper_repl_markdown, s) 1732 s = self.hyper_re.sub(self._hyper_repl_markdown, s)
1733 return u2s(markdown(s2u(s))) 1733 try:
1734 s = u2s(markdown(s2u(s)))
1735 except Exception: # when markdown formatting fails return markup
1736 return self.plain(escape=0, hyperlink=hyperlink)
1737 return s
1734 1738
1735 def field(self, **kwargs): 1739 def field(self, **kwargs):
1736 """ Render the property as a field in HTML. 1740 """ Render the property as a field in HTML.
1737 1741
1738 If not editable, just display the value via plain(). 1742 If not editable, just display the value via plain().

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