diff gpp/core/functions.py @ 9:b3b11edf91d8

News: removed the lxml stuff. Based on Jacob Kaplan-Moss suggestion, use html5lib to clean html. Added that functionality in a new core.html module.
author Brian Neal <bgneal@gmail.com>
date Sun, 12 Apr 2009 02:03:03 +0000
parents dbd703f7d63a
children 91fd31dc78fb
line wrap: on
line diff
--- a/gpp/core/functions.py	Sun Apr 12 00:34:08 2009 +0000
+++ b/gpp/core/functions.py	Sun Apr 12 02:03:03 2009 +0000
@@ -5,25 +5,6 @@
 from django.conf import settings
 
 from core import logging
-from lxml.html.clean import Cleaner
-
-html_cleaner = Cleaner(scripts=True,
-        javascript=True,
-        comments=True,
-        style=True,
-        links=True,
-        meta=True,
-        page_structure=True,
-        processing_instructions=True,
-        embedded=True,
-        frames=True,
-        forms=True,
-        annoying_tags=True,
-        remove_unknown_tags=True,
-        safe_attrs_only=True,
-        host_whitelist=['www.youtube.com'],
-        whitelist_tags=['object', 'param', 'embed'],
-        )
 
 
 def send_mail(subject, message, from_email, recipient_list, 
@@ -61,13 +42,6 @@
             [mail_tuple[1] for mail_tuple in settings.MANAGERS])
 
 
-def clean_html(s):
-    """Cleans HTML of dangerous tags and content."""
-    if s:
-        return html_cleaner.clean_html(s)
-    return s
-
-
 def get_full_name(user):
     """Returns the user's full name if available, otherwise falls back
     to the username."""
@@ -75,3 +49,5 @@
     if full_name:
         return full_name
     return user.username
+
+# vim: ts=4 sw=4