def __call__(self, **kwargs): """ Generate the HTML code of the current widget. Keyword arguments are used to format the generated HTML. >>> a = DemoWidget('hello.world', '{name}') >>> a(name='demo') '<input name="demo" ng-model="hello.world"/> """ for modifier in self.modifiers: if hasattr(modifier, 'attributes'): self.html_attributes.update(modifier.attributes) template = Template(self.html_template).render(widget=self) return HTMLString(template.strip().format(**kwargs))
def setup(self): self.html = HTMLString(u'hello')