X-Git-Url: http://gitweb.fperrin.net/?p=djsite.git;a=blobdiff_plain;f=quotes%2Fmassimport.py;fp=quotes%2Fmassimport.py;h=cf63152f84e9b5a98b0c53b6fbea89904e7619ae;hp=ade6f3899879bdbc5a76a9d10e12b0bc71ac8b02;hb=160b72e5d6f1fa0ed23471bf59231555d5907b08;hpb=de98b439b7a5dbf2c95dde312b6024b86aa45074 diff --git a/quotes/massimport.py b/quotes/massimport.py index ade6f38..cf63152 100644 --- a/quotes/massimport.py +++ b/quotes/massimport.py @@ -1,5 +1,6 @@ import re from django.db import DatabaseError, transaction +from django.utils.html import linebreaks from quotes.models import QuoteTag, Quote, Work, Author @@ -41,13 +42,8 @@ def add_tags_on_quote(quote, tagline, resultcontext): quote.tags.add(tag) def paragraphize(text): - paragraph = "" - for line in text.splitlines(): - line = line.strip() - if not line: continue - paragraph += "

%s

" % line - # rest of the HTML will be bleach.clean()'d - return paragraph + text = text.strip() + return linebreaks(text) def create_quote(quotetext, authorname, workname, tagline, resultcontext): author = get_or_create_author(authorname, resultcontext)