From d8e9d4b06bfdc14245091878480f17da51bf58f8 Mon Sep 17 00:00:00 2001 From: Seth Woodworth Date: Thu, 23 May 2013 15:18:14 -0400 Subject: [PATCH] comment the strip_html management command --- .../apps/notes/management/commands/strip_html_to_text.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/karmaworld/apps/notes/management/commands/strip_html_to_text.py b/karmaworld/apps/notes/management/commands/strip_html_to_text.py index 2fa00c0..a74d4ce 100644 --- a/karmaworld/apps/notes/management/commands/strip_html_to_text.py +++ b/karmaworld/apps/notes/management/commands/strip_html_to_text.py @@ -8,13 +8,17 @@ from django.core.management.base import BaseCommand from apps.notes.models import Note class Command(BaseCommand): + """ Command to process notes with html, and without text + to refill text sans html tags """ args = 'none' help = "Take all notes with the .html property and use that to fill Note.text by stripping html" def handle(self, *args, **kwargs): + """ On all calls, clean all notes with html and not text using lxml """ notes = Note.objects.filter(html__isnull=False).filter(text__isnull=True) cleaned_notes = 0 for note in notes: + #TODO: find style tags and drop them and their contents first note.text = fromstring(note.html).text_content() note.save() cleaned_notes += 1 -- 2.25.1