Simplify and "fix" render_old_messages management command.

The command to render old messages now looks for all messages
not matching the bugdown version, and it no longer directly calls
into model code.  We should still be extremely cautious about
using this code.
This commit is contained in:
Steve Howell
2016-10-04 08:35:36 -07:00
parent 6b71f5bd5f
commit 7fb992dba3
3 changed files with 20 additions and 18 deletions

View File

@@ -213,3 +213,19 @@ class MessageDict(object):
return obj
def re_render_content_for_management_command(message):
# type: (Message) -> None
'''
Please avoid using this function, as its only used in a management command that
is somewhat deprecated.
'''
assert Message.need_to_render_content(message.rendered_content,
message.rendered_content_version,
bugdown.version)
rendered_content = message.render_markdown(message.content)
message.rendered_content = rendered_content
message.rendered_content_version = bugdown.version
message.save_rendered_content()