--- a/app/soc/logic/cleaning.py Thu Mar 05 22:29:29 2009 +0000
+++ b/app/soc/logic/cleaning.py Thu Mar 05 22:30:06 2009 +0000
@@ -288,17 +288,28 @@
return feed_url
-def clean_document_content(self):
- """Clean method for cleaning document content.
+def clean_html_content(field_name):
+ """Clean method for cleaning HTML content.
"""
- content = self.cleaned_data.get('content')
+
+ @check_field_is_empty(field_name)
+ def wrapped(self):
+ """Decorator wrapper method.
+ """
+
+ content = self.cleaned_data.get(field_name)
- sanitizer = feedparser._HTMLSanitizer('utf-8')
- sanitizer.feed(content)
- content = sanitizer.output()
- content = content.strip().replace('\r\n', '\n')
+ if user_logic.isDeveloper():
+ return content
- return content
+ sanitizer = feedparser._HTMLSanitizer('utf-8')
+ sanitizer.feed(content)
+ content = sanitizer.output()
+ content = content.strip().replace('\r\n', '\n')
+
+ return content
+
+ return wrapped
def clean_url(field_name):
"""Clean method for cleaning a field belonging to a LinkProperty.