From: jordan Date: Thu, 11 Aug 2011 09:52:30 +0000 (+0000) Subject: reverting the changes made in commit #1097 for Jira OSQA-593, it resulted another... X-Git-Tag: live~158 X-Git-Url: https://git.openstreetmap.org/osqa.git/commitdiff_plain/7fb43328b198f5b5dc7f829b2facf9e25704e8e6 reverting the changes made in commit #1097 for Jira OSQA-593, it resulted another issue with the escaping of backslashes git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1159 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- diff --git a/forum/models/comment.py b/forum/models/comment.py index 32fdf5d..45c5962 100644 --- a/forum/models/comment.py +++ b/forum/models/comment.py @@ -17,8 +17,7 @@ class Comment(Node): @property def comment(self): if settings.FORM_ALLOW_MARKDOWN_IN_COMMENTS: - # Avoid doing double replacement of backslashes - return self._as_markdown_raw(self.body,'limitedsyntax') + return self.as_markdown('limitedsyntax') else: return self.body diff --git a/forum/models/node.py b/forum/models/node.py index 6d51793..72ef0c0 100644 --- a/forum/models/node.py +++ b/forum/models/node.py @@ -29,7 +29,7 @@ class NodeContent(models.Model): return auto_user_link(self, self._as_markdown(content, *['auto_linker'])) @classmethod - def _as_markdown_raw(cls, content, *extensions): + def _as_markdown(cls, content, *extensions): try: return mark_safe(sanitize_html(markdown.markdown(content, extensions=extensions))) except Exception, e: @@ -38,11 +38,6 @@ class NodeContent(models.Model): str(e), cls.__name__, str(e), traceback.format_exc())) return '' - # Replace \ with \\ to preserve backslashes during markdown processing - @classmethod - def _as_markdown(cls, content, *extensions): - return cls._as_markdown_raw(content.replace('\\','\\\\'), *extensions) - def as_markdown(self, *extensions): return self._as_markdown(self.body, *extensions)