Mercurial > public > sg101
diff gpp/forums/views/main.py @ 566:4b9970ad0edb
For bitbucket issue #6, try to improve quoting messages.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 04 Mar 2012 14:52:24 -0600 |
parents | 98b373ca09f3 |
children |
line wrap: on
line diff
--- a/gpp/forums/views/main.py Sun Mar 04 13:20:40 2012 -0600 +++ b/gpp/forums/views/main.py Sun Mar 04 14:52:24 2012 -0600 @@ -18,14 +18,13 @@ from django.template.loader import render_to_string from django.template import RequestContext from django.views.decorators.http import require_POST -from django.utils.text import wrap from django.db.models import F import antispam import antispam.utils from bio.models import UserProfile, BadgeOwnership from core.paginator import DiggPaginator -from core.functions import email_admins +from core.functions import email_admins, quote_message from forums.models import (Forum, Topic, Post, FlaggedPost, TopicLastVisit, ForumLastVisit, Attachment) @@ -620,7 +619,7 @@ if quote_id: quote_post = get_object_or_404(Post.objects.select_related(), pk=quote_id) - form = PostForm(initial={'body': _quote_message(quote_post.user.username, + form = PostForm(initial={'body': quote_message(quote_post.user.username, quote_post.body)}) else: form = PostForm() @@ -1001,18 +1000,6 @@ profile.save(content_update=False) -def _quote_message(who, message): - """ - Builds a message reply by quoting the existing message in a - typical email-like fashion. The quoting is compatible with Markdown. - """ - header = '*%s wrote:*\n\n' % (who, ) - lines = wrap(message, 55).split('\n') - for i, line in enumerate(lines): - lines[i] = '> ' + line - return header + '\n'.join(lines) + '\n\n' - - def _move_topic(topic, old_forum, new_forum): if new_forum != old_forum: topic.forum = new_forum