Ticket #6387: markdown-1.7-support2.diff

File markdown-1.7-support2.diff, 1.0 KB (added by jedie, 11 years ago)
  • django/contrib/markup/templatetags/markup.py

     
    6565                safe_mode = True
    6666            else:
    6767                safe_mode = False
    68             return mark_safe(force_unicode(markdown.markdown(smart_str(value), extensions, safe_mode=safe_mode)))
     68
     69            # unicode support only in markdown v1.7 or above.
     70            # version_info exist only in markdown v1.6.2rc-2 or above.
     71            if getattr(markdown, "version_info", None) < (1,7)
     72                return mark_safe(force_unicode(markdown.markdown(smart_str(value), extensions, safe_mode=safe_mode)))
     73            else:
     74                return mark_safe(markdown.markdown(force_unicode(value), extensions, safe_mode=safe_mode))
    6975        else:
    7076            return mark_safe(force_unicode(markdown.markdown(smart_str(value))))
    7177markdown.is_safe = True
Back to Top