| Trees | Indices | Help |
|
|---|
object --+ | genshi.filters.html.HTMLSanitizer --+ | TracHTMLSanitizer
frozenset([None, 'file', 'ftp', 'http', 'https', 'mailto']),
safe_css=frozenset(['background', 'background-attachment', 'background-...)list
Inherited from genshi.filters.html.HTMLSanitizer:
is_safe_elem,
is_safe_uri
Inherited from object:
__delattr__,
__format__,
__getattribute__,
__hash__,
__new__,
__reduce__,
__reduce_ex__,
__repr__,
__setattr__,
__sizeof__,
__str__,
__subclasshook__
frozenset(['background', 'background-attachment', '...
Inherited from genshi.filters.html.HTMLSanitizer:
SAFE_ATTRS,
SAFE_SCHEMES,
SAFE_TAGS,
URI_ATTRS
Inherited from object:
__class__
frozenset([None, 'file', 'ftp', 'http', 'https', 'mailto']),
safe_css=frozenset(['background', 'background-attachment', 'background-...)
Create the sanitizer.
The exact set of allowed elements and attributes can be configured.
safe_tags - a set of tag names that are considered safesafe_attrs - a set of attribute names that are considered safesafe_schemes - a set of URI schemes that are considered safeuri_attrs - a set of names of attributes that contain URIsRemove potentially dangerous property declarations from CSS code.
In particular, properties using the CSS url() function with a scheme that is not considered safe are removed:
>>> sanitizer = HTMLSanitizer() >>> sanitizer.sanitize_css(u''' ... background: url(javascript:alert("foo")); ... color: #000; ... ''') ['color: #000']
Also, the proprietary Internet Explorer function expression() is always stripped:
>>> sanitizer.sanitize_css(u''' ... background: #fff; ... color: #000; ... width: e/**/xpression(alert("foo")); ... ''') ['background: #fff', 'color: #000']
text - the CSS text; this is expected to be unicode and to not
contain any character or numeric referencesliststream - the markup event stream to filterpropname - the CSS property namevalue - the value of the propertyfrozenset(['background','background-attachment','background-color','background-image','background-position','background-repeat','border','border-bottom',...
| Trees | Indices | Help |
|
|---|