Ticket #4881: rst_django_bug.diff

File rst_django_bug.diff, 1.0 KB (added by Rafael Weber, 8 years ago)
Line 
1Index: django/trunk/django/contrib/markup/templatetags/markup.py
2===================================================================
3@@ -42,18 +42,17 @@
4 
5 def restructuredtext(value):
6     try:
7-        from docutils.core import publish_parts
8+        from docutils.core import publish_string
9     except ImportError:
10         if settings.DEBUG:
11             raise template.TemplateSyntaxError, "Error in {% restructuredtext %} filter: The Python docutils library isn't installed."
12         return force_unicode(value)
13     else:
14         docutils_settings = getattr(settings, "RESTRUCTUREDTEXT_FILTER_SETTINGS", {})
15-        parts = publish_parts(source=smart_str(value), writer_name="html4css1", settings_overrides=docutils_settings)
16-        return force_unicode(parts["fragment"])
17+        result = publish_string(source=smart_str(value), writer_name="html4css1", settings_overrides=docutils_settings)
18+        return force_unicode(result)
19 
20 register.filter(textile)
21 register.filter(markdown)
22 register.filter(restructuredtext)
23 
24-
Back to Top