hi,
you use quite a few private methods so your code might easily break in
the future ;)
A more stable and also simpler function would be (http://
paste.pocoo.org/show/80858/):
def filter_style(css):
if css is None:
return None
# renamed from "sheet" as only a style declaration
style = CSSStyleDeclaration(css)
for property in style:
name =
property.name
if not _allowed_properties_re.match(name):
print u"removing %r" % name
del style[name]
# normally style.cssText but there is another method:
return style.getCssText(separator='')
You don't need the special _parse method nor the special serializer
(the only thing you need to keep is the list of allowed properties).
hope this helps
Christof
On Jul 31, 11:27 am, "
enteq...@googlemail.com"