Fixed #6387 -- Updated markdown filter to handle markdown-1.7 as well as

earlier versions. Patch from cogg, jedie and Dmitri Fedortchenko.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7423 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2008-04-15 02:00:15 +00:00
parent ea87c0df5c
commit 8453a1750f
1 changed files with 7 additions and 1 deletions

View File

@ -65,7 +65,13 @@ def markdown(value, arg=''):
safe_mode = True safe_mode = True
else: else:
safe_mode = False safe_mode = False
return mark_safe(force_unicode(markdown.markdown(smart_str(value), extensions, safe_mode=safe_mode)))
# Unicode support only in markdown v1.7 or above. Version_info
# exist only in markdown v1.6.2rc-2 or above.
if getattr(markdown, "version_info", None) < (1,7):
return mark_safe(force_unicode(markdown.markdown(smart_str(value), extensions, safe_mode=safe_mode)))
else:
return mark_safe(markdown.markdown(force_unicode(value), extensions, safe_mode=safe_mode))
else: else:
return mark_safe(force_unicode(markdown.markdown(smart_str(value)))) return mark_safe(force_unicode(markdown.markdown(smart_str(value))))
markdown.is_safe = True markdown.is_safe = True