From: Matthijs Kooijman Date: Tue, 4 Nov 2008 10:54:05 +0000 (+0100) Subject: Use the rewrap function for wrapping comments. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=682f6cde0a7bb2c822eb9ef69583259454a0d97b;p=matthijs%2Fprojects%2Fxerxes.git Use the rewrap function for wrapping comments. --- diff --git a/influences/models.py b/influences/models.py index 049cbeb..78daa15 100644 --- a/influences/models.py +++ b/influences/models.py @@ -1,9 +1,10 @@ from django.db import models from django.core.urlresolvers import reverse from django.contrib.auth.models import User -from django.utils.text import normalize_newlines, wrap +from django.utils.text import normalize_newlines from django.utils.translation import ugettext_lazy as _ from threadedcomments.models import ThreadedComment +from xerxes.tools.text import rewrap # Create your models here. class Character(models.Model): @@ -61,7 +62,8 @@ class Influence(models.Model): If private is True, private comments are included in this list. """ def quote_reply(comment): - text = wrap(normalize_newlines(comment.comment), 72) + regex = "^([ >]*)(.*)$" + text = rewrap(normalize_newlines(comment.comment), 72, regex) return "\n".join(["> " + l for l in text.split("\n")]) # Import here to prevent dependency loop, since forms depends on