Module Import alias Import alias Import alias ImportFrom alias ImportFrom alias ClassDef bases AttributeLoad NameLoad attr body Expr Str FunctionDef arguments args NameParam defaults body Assign AttributeStore NameLoad attr Dict Str Str Str Str Str ListLoad Str Str Str Str Str Str Str Str Str Str Str Str Str Str ListLoad Str Str Str Str Str Str ListLoad Str Str Str Str Str Str Str Dict ListLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Return Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr Str Str decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr Str Str decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr Str Str Expr Call AttributeLoad NameLoad attr Str Str Expr Call AttributeLoad NameLoad attr Str Str Expr Call AttributeLoad NameLoad attr Str Str Expr Call AttributeLoad NameLoad attr Str Str Expr Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Str attr Str Expr Call AttributeLoad NameLoad attr Str Str decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Str attr Str Assign NameStore Call AttributeLoad NameLoad attr Str Assert CompareIn Str NameLoad decorator_list Call AttributeLoad NameLoad attr Str FunctionDef arguments args NameParam defaults body Assign SubscriptStore SubscriptLoad AttributeLoad NameLoad attr Index Str Index Str ListLoad Str Assign SubscriptStore SubscriptLoad AttributeLoad NameLoad attr Index Str Index Str Lambda arguments args NameParam defaults CompareIn Str NameLoad Expr Call AttributeLoad NameLoad attr Str Str Expr Call AttributeLoad NameLoad attr Str Str Expr Call AttributeLoad NameLoad attr Str Str decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr NameLoad Str Assign NameStore Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr NameLoad Str Assign NameStore Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr NameLoad Str Assign NameStore Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr NameLoad Str decorator_list FunctionDef arguments args NameParam defaults body Assign SubscriptStore AttributeLoad NameLoad attr Index Str Str Assign NameStore Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr NameLoad Str decorator_list Call AttributeLoad NameLoad attr Str FunctionDef arguments args NameParam defaults body Assign SubscriptStore AttributeLoad NameLoad attr Index Str ListLoad Assign NameStore Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr NameLoad Str decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr Str Str Expr Call AttributeLoad NameLoad attr Str Str decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Str attr Str Assign NameStore Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr NameLoad Str decorator_list Call AttributeLoad NameLoad attr Str FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr NameLoad Str decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr NameLoad Str Assign NameStore Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr NameLoad Str decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return NameLoad Assign NameStore Num If Call AttributeLoad AttributeLoad NameLoad attr attr Str body Assign SubscriptStore AttributeLoad NameLoad attr Index Str ListLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad For TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr Str body For NameStore Call NameLoad Lambda arguments args NameParam defaults Call AttributeLoad NameLoad attr Str NameLoad body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad Assign NameStore Call AttributeLoad Call AttributeLoad Call NameLoad NameLoad Str attr attr Str Assign NameStore Call AttributeLoad Call AttributeLoad Call NameLoad BinOpAdd SubscriptLoad NameLoad Slice Num Str Str attr attr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr If CompareNotEq NameLoad NameLoad body If CompareLt NameLoad Num body Print NameLoad Str BinOpAdd BinOpAdd BinOpAdd NameLoad Str NameLoad Str AugAssignSub NameStore Num If UnaryOpNot NameLoad body Return decorator_list FunctionDef arguments args NameParam defaults body Assign AttributeStore NameLoad attr Dict Assign NameStore Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr NameLoad Str decorator_list FunctionDef arguments args NameParam defaults body Assign SubscriptStore AttributeLoad NameLoad attr Index Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr NameLoad Str decorator_list Call AttributeLoad NameLoad attr Str FunctionDef arguments args NameParam defaults body Assign SubscriptStore AttributeLoad NameLoad attr Index Str ListLoad Str Str Str Assign SubscriptStore AttributeLoad NameLoad attr Index Str NameLoad Expr Call AttributeLoad NameLoad attr Str Str Expr Call AttributeLoad NameLoad attr Str Str Expr Call AttributeLoad NameLoad attr Str Str Expr Call AttributeLoad NameLoad attr Str Str Expr Call AttributeLoad NameLoad attr Str Str Expr Call AttributeLoad NameLoad attr Str Str Expr Call AttributeLoad NameLoad attr Str Str decorator_list FunctionDef arguments args NameParam defaults body Assign SubscriptStore AttributeLoad NameLoad attr Index Str ListLoad Str Str Str Assign SubscriptStore AttributeLoad NameLoad attr Index Str NameLoad Expr Call AttributeLoad NameLoad attr Str Str decorator_list FunctionDef arguments args NameParam defaults body Assign SubscriptStore AttributeLoad NameLoad attr Index Str ListLoad Str Str Str Assign SubscriptStore AttributeLoad NameLoad attr Index Str NameLoad Expr Call AttributeLoad NameLoad attr Str Str Expr Call AttributeLoad NameLoad attr Str Str Expr Call AttributeLoad NameLoad attr Str Str decorator_list FunctionDef arguments args NameParam defaults body Assign SubscriptStore AttributeLoad NameLoad attr Index Str ListLoad Str Str Str Assign SubscriptStore AttributeLoad NameLoad attr Index Str NameLoad Assign SubscriptStore AttributeLoad NameLoad attr Index Str ListLoad Expr Call AttributeLoad NameLoad attr Str Str Expr Call AttributeLoad NameLoad attr Str Str Expr Call AttributeLoad NameLoad attr Str Str decorator_list FunctionDef arguments args NameParam defaults body Assign SubscriptStore AttributeLoad NameLoad attr Index Str ListLoad Str Str Str Assign SubscriptStore AttributeLoad NameLoad attr Index Str NameLoad Expr Call AttributeLoad NameLoad attr Str Str decorator_list FunctionDef arguments args NameParam defaults body Assign SubscriptStore AttributeLoad NameLoad attr Index Str ListLoad Str Str Str Assign SubscriptStore AttributeLoad NameLoad attr Index Str Str Expr Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Str attr Str Expr Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Str attr Str Expr Call AttributeLoad NameLoad attr Str Str decorator_list FunctionDef arguments args NameParam defaults body Assign SubscriptStore AttributeLoad NameLoad attr Index Str ListLoad Str Str Str Assign SubscriptStore AttributeLoad NameLoad attr Index Str Lambda arguments args defaults Call NameLoad Str Expr Call AttributeLoad NameLoad attr Str Str Expr Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Str attr Str decorator_list FunctionDef arguments args NameParam defaults body Assign SubscriptStore AttributeLoad NameLoad attr Index Str ListLoad Str Str Str Assign SubscriptStore AttributeLoad NameLoad attr Index Str NameLoad Expr Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Str attr Str Expr Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args NameParam defaults body Assign SubscriptStore AttributeLoad NameLoad attr Index Str NameLoad Expr Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Str attr Str Expr Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list decorator_list FunctionDef arguments args NameParam defaults kwarg body Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr Str attr Str NameLoad Return Call AttributeLoad NameLoad attr decorator_list
N/A N/A unittest N/A os N/A re iktomi.utils html lxml.html Element TestSanitizer N/A N/A unittest TestCase N/A N/A Tests for sanitizer based on lxml setUp N/A N/A self N/A N/A N/A N/A self attrs N/A allow_tags safe_attrs drop_empty_tags allow_classes tags_to_wrap N/A a p br li ul ol hr u i b blockquote sub sup span N/A href src alt title class rel N/A p a u i b sub sup N/A N/A N/A sanitize N/A N/A self text N/A N/A N/A N/A N/A html sanitize text N/A self attrs N/A assertSanitize N/A N/A self text right N/A N/A N/A res N/A N/A self sanitize text N/A N/A N/A self assertEqual res right N/A test_safe_attrs N/A N/A self N/A N/A N/A N/A N/A self assertSanitize <p notsafeattr="s" abbr="1" alt="Alt">Safe p</p> <p alt="Alt">Safe p</p> N/A test_safe_tags N/A N/A self N/A N/A N/A N/A N/A self assertSanitize <p alt="Alt">Safe p <script>bad_script()</script></p> <accept>acc</accept> <p alt="Alt">Safe p </p> acc N/A test_empty_tags N/A N/A self N/A N/A N/A N/A N/A self assertSanitize <p alt="Alt">p</p><p alt="Alt">  </p><p style="color:red"></p><p></p> <p alt="Alt">p</p><p alt="Alt">  </p> N/A N/A N/A self assertSanitize <b>some<span> </span>text</b> <b>some<span> </span>text</b> N/A N/A N/A self assertSanitize <p>head</p><p><br></p><p>tail</p> <p>head</p><p>tail</p> N/A N/A N/A self assertSanitize <p>head</p><p><b><i> <br />  </i></b></p><p>tail</p> <p>head</p><p>tail</p> N/A N/A N/A self assertSanitize <p>head</p><p><b>mid<i></i></b></p><p>tail</p> <p>head</p><p><b>mid</b></p><p>tail</p> N/A N/A N/A N/A N/A self attrs N/A allow_tags append div N/A N/A N/A self assertSanitize <div>text<br>text</div> <div>text<br>text</div> N/A test_safe_css N/A N/A self N/A N/A N/A Ensure that sanitizer does not remove safe css N/A N/A N/A N/A N/A self attrs N/A allowed_attributes append style N/A res N/A N/A self sanitize <p style="color: #000; background-color: red; font-size: 1.2em">p</p> N/A N/A color: #000; background-color: red; font-size: 1.2em res N/A N/A N/A unittest skip lxml does not provide css filtration test_allowed_classes N/A N/A self N/A N/A N/A N/A N/A N/A self attrs N/A allow_classes N/A p N/A yellow N/A N/A N/A N/A self attrs N/A allow_classes N/A b N/A N/A N/A x N/A N/A b x N/A N/A N/A self assertSanitize <p class="yellow green"> <p class="yellow"></p> N/A N/A N/A self assertSanitize <sup class="yellow green" title="Alt">a</sup> <sup title="Alt">a</sup> N/A N/A N/A self assertSanitize <b class="has_b has_c">a</b> <b class="has_b">a</b> N/A test_tags_sticking N/A N/A self N/A N/A N/A res N/A N/A self sanitize <p>a</p> <p>b</p> N/A N/A N/A self assertEqual res <p>a</p> <p>b</p> N/A res N/A N/A self sanitize <b>a</b> <b>b</b> N/A N/A N/A self assertEqual res <b>a</b> <b>b</b> N/A res N/A N/A self sanitize <brbr>a</brbr> <p>b</p> N/A N/A N/A self assertEqual res a <p>b</p> N/A res N/A N/A self sanitize <p><brbr>a</brbr> <brbr>b</brbr></p> N/A N/A N/A self assertEqual res <p>a b</p> N/A test_autoclosing_attrs_xhtml N/A N/A self N/A N/A N/A N/A N/A self attrs N/A method xhtml N/A res N/A N/A self sanitize <br><hr>b  N/A N/A N/A self assertEqual res <br /><hr />b N/A N/A N/A unittest skip not supported test_autoclosing_attrs_html N/A N/A self N/A N/A N/A N/A N/A self attrs N/A drop_empty_tags N/A N/A res N/A N/A self sanitize <br><hr>b <p> N/A N/A N/A self assertEqual res <br><hr>b <p></p> N/A test_remove_empty_a N/A N/A self N/A N/A N/A N/A N/A self assertSanitize <a href="moo">BLABLA</a> <a>txt <span>foo</span></a> <a href="moo">BLABLA</a> txt <span>foo</span> N/A N/A N/A self assertSanitize <p><a>run</a><b><a>bar</a></b></p> <p>run<b>bar</b></p> N/A test_unsafe_css N/A N/A self N/A N/A N/A Special test for html5: html5lib has very ultimate css cleanup with gauntlets N/A N/A N/A N/A N/A self attrs N/A allowed_attributes append style N/A res N/A N/A self sanitize <p style="background: url(javascript:void); color: #000; width: e/**/xpression(alert());">p</p> N/A N/A N/A self assertEqual res <p>p</p> N/A N/A N/A unittest skip lxml does not provide css filtration test_plain_text N/A N/A self N/A N/A N/A res N/A N/A self sanitize Some plain text N/A N/A N/A self assertEqual res Some plain text N/A test_empty_strings N/A N/A self N/A N/A N/A res N/A N/A self sanitize N/A N/A N/A self assertEqual res N/A res N/A N/A self sanitize N/A N/A N/A self assertEqual res N/A test_on_real_data N/A N/A self N/A N/A N/A 
            Compare with logged genshi output to ensure that there are no
            new errors
         N/A None N/A skips 10 N/A N/A N/A N/A os path isdir clean_html N/A N/A N/A N/A self attrs N/A string_callbacks N/A N/A html remove_TinyMCE_trash N/A html strip_empty_tags_nested spaceless N/A N/A dir dirs files N/A N/A os walk clean_html N/A N/A file N/A filter N/A N/A N/A x N/A N/A N/A x endswith .in files N/A N/A path N/A N/A N/A os path join dir file N/A in_ N/A N/A N/A N/A N/A open path r read decode utf-8 N/A out N/A N/A N/A N/A N/A open N/A N/A path N/A -3 .out r read decode utf-8 N/A out N/A N/A html remove_TinyMCE_trash out N/A res N/A N/A N/A N/A self sanitize in_ strip N/A N/A res out N/A N/A N/A skips 10 N/A N/A in_ 
----------
 N/A N/A N/A res ---
!=
 out ---


 N/A skips 1 N/A N/A skips N/A N/A N/A test_no_initial_data N/A N/A self N/A N/A N/A N/A self attrs N/A N/A res N/A N/A self sanitize a<p color: #000" class="2">p</p><script></script> N/A N/A N/A self assertEqual res a<p>p</p> N/A test_escaping N/A N/A self N/A N/A N/A N/A N/A self attrs N/A escape_invalid_tags True N/A res N/A N/A self sanitize a<p>p</p><script>alert()</script> N/A N/A N/A self assertEqual res a<p>p</p>&lt;script&gt;alert()&lt;/script&gt; N/A N/A N/A unittest skip lxml does not support this option test_tags_to_wrap N/A N/A self N/A N/A N/A N/A N/A self attrs N/A tags_to_wrap N/A b i br N/A N/A N/A self attrs N/A wrap_inline_tags True N/A N/A N/A self assertSanitize head<b>bold</b>tail <p>head<b>bold</b>tail</p> N/A N/A N/A self assertSanitize head<b>bold</b>boldtail<i>italic</i><p>par</p>tail <p>head<b>bold</b>boldtail<i>italic</i></p><p>par</p><p>tail</p> N/A N/A N/A self assertSanitize <p>par</p><b>bla</b>text<p>blabla</p> <p>par</p><p><b>bla</b>text</p><p>blabla</p> N/A N/A N/A self assertSanitize <p>par</p>text<b>bla</b>text<p>blabla</p> <p>par</p><p>text<b>bla</b>text</p><p>blabla</p> N/A N/A N/A self assertSanitize first<br>second<br>third <p>first</p><p>second</p><p>third</p> N/A N/A N/A self assertSanitize first<br>second<p>third</p> <p>first</p><p>second</p><p>third</p> N/A N/A N/A self assertSanitize <p>first</p>tail<br>second<p>third</p> <p>first</p><p>tail</p><p>second</p><p>third</p> N/A test_tags_to_wrap_trailing_br N/A N/A self N/A N/A N/A N/A N/A self attrs N/A tags_to_wrap N/A b i br N/A N/A N/A self attrs N/A wrap_inline_tags True N/A N/A N/A self assertSanitize <p>head</p><br>  <p>head</p> N/A test_tags_to_wrap_double_br N/A N/A self N/A N/A N/A N/A N/A self attrs N/A tags_to_wrap N/A b i br N/A N/A N/A self attrs N/A wrap_inline_tags True N/A N/A N/A self assertSanitize head<br><br>tail <p>head</p><p>tail</p> N/A N/A N/A self assertSanitize head<br> <br>tail <p>head</p><p>tail</p> N/A N/A N/A self assertSanitize <br><br><br><br> N/A test_split_paragraphs_by_br N/A N/A self N/A N/A N/A N/A N/A self attrs N/A tags_to_wrap N/A b i br N/A N/A N/A self attrs N/A wrap_inline_tags True N/A N/A N/A self attrs N/A drop_empty_tags N/A N/A N/A N/A self assertSanitize <p>head<br><br><br></p> <p>head</p><p></p><p></p><p></p> N/A N/A N/A self assertSanitize <p>head<br>body<br>tail</p> <p>head</p><p>body</p><p>tail</p> N/A N/A N/A self assertSanitize <p>head<br><b>body<sup>letters</sup></b><br><i>ta</i>il</p> <p>head</p><p><b>body<sup>letters</sup></b></p><p><i>ta</i>il</p> N/A test_wrap_inline_tags N/A N/A self N/A N/A N/A N/A N/A self attrs N/A tags_to_wrap N/A b i br N/A N/A N/A self attrs N/A wrap_inline_tags False N/A N/A N/A self assertSanitize first<br>second<br>third first<br>second<br>third N/A test_p_not_allowed N/A N/A self N/A N/A N/A N/A N/A self attrs N/A tags_to_wrap N/A b i br N/A N/A N/A self attrs N/A wrap_inline_tags div N/A N/A N/A N/A N/A self attrs N/A allow_tags remove p N/A N/A N/A N/A N/A self attrs N/A allow_tags append div N/A N/A N/A self assertSanitize head<br><br>tail <div>head</div><div>tail</div> N/A test_lambda_wrap_tag N/A N/A self N/A N/A N/A N/A N/A self attrs N/A tags_to_wrap N/A b i br N/A N/A N/A self attrs N/A wrap_inline_tags N/A N/A N/A N/A N/A Element span N/A N/A N/A self assertSanitize head<br><br>tail <span>head</span><span>tail</span> N/A N/A N/A N/A N/A self attrs N/A allow_tags remove p N/A test_no_wrap_tags N/A N/A self N/A N/A N/A N/A N/A self attrs N/A tags_to_wrap N/A b i br N/A N/A N/A self attrs N/A wrap_inline_tags True N/A N/A N/A N/A N/A self attrs N/A allow_tags remove p N/A N/A N/A self assertRaises ValueError N/A self sanitize head<br><br>tail N/A test_create_cleaner_with_wrong_parameters N/A N/A self N/A N/A N/A N/A N/A self attrs N/A wrap_inline_tags True N/A N/A N/A N/A N/A self attrs N/A allow_tags remove p N/A N/A N/A self assertRaises ValueError N/A html Cleaner N/A self attrs N/A N/A spaceless N/A N/A clean N/A kwargs N/A N/A clean N/A N/A N/A N/A re compile \s+ sub clean N/A N/A N/A clean strip N/A