def begin(self): attrs = HtmlAttributeHolder(**self.element.attributes) attrs.add_attr('class', 'static-form') for attr in ('enctype', 'method', 'action'): try: attrs.del_attr(attr) except KeyError: pass self.output.inc(HTML.div(None, _closed=False, **attrs.attributes))
def test_del_attr(self): ah = HtmlAttributeHolder(src='src', class_='class') ah.del_attr('src') ah.del_attr('class') assert 'src' not in ah.attributes assert 'class' not in ah.attributes