Opened 16 years ago

Closed 16 years ago

#2132 closed defect (duplicate)

Markup contrib module return different types for different markups

Reported by: David Larlet <larlet@…> Owned by: Adrian Holovaty
Component: Contrib apps Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I want to use from django.contrib.markup.templatetags.markup import * and after:

    ('textile', 'Textile'),
    ('markdown', 'Markdown'),
    ('restructuredtext', 'ReST'),

def save(self):
    markup_func = globals()[self.markup]
    self.content_html = markup_func(self.content)
    super(Post, self).save() # Call the "real" save() method.

It works well for textile and markdown but there is an issue with restructuredtext because it returns unicode and not string so I have to do:

    self.content_html = str(markup_func(self.content))

This not really a critical bug but it's annoying because markup functions didn't return the same type... the patch is really easy:
in /django/contrib/markup/templatetags/, replace :

return parts["fragment"]


return str(parts["fragment"])

I don't know if it's a problem for filters.

Change History (1)

comment:1 Changed 16 years ago by Adrian Holovaty

Resolution: duplicate
Status: newclosed

Closing in favor of #2489.

Note: See TracTickets for help on using tickets.
Back to Top