def render(self, context): if callable(self.add_url): add_url = self.add_url(self.type) else: add_url = self.add_url return html.Form(method="post", action=add_url, onsubmit="return on_todo_add_submit(this);")( html.Label()(html.Raw("New "), self.type, html.Raw(": ")), html.InputText(name="todo"), html.Button(type="submit")(html.Raw("Add")), )
def render(self, context): css = html.Raw(TYPESET_CSS) return html.Style(type="text/css")(css) if self.with_tag else css
def render_style(self, context): return <CSSCollector.Collect>{html.Raw(".content { margin: 15px; }")} </CSSCollector.Collect>
def render(self, context): return <CSSCollector.Collect namespace="bar">{html.Raw( "C3Collect%sBar" % self.id )}</CSSCollector.Collect>
def render(self, context): return <CSSCollector.Collect>{html.Raw("C2Collect%sDefault" % self.id)}</CSSCollector.Collect>
def render(self, context): js = html.Raw(JS) return html.Script( type="text/javascript")(html.Raw(js)) if self.with_tag else js
def test_escaping(): assert str(<div class="&">&{'&'}</div>) == '<div class="&">&&</div>' assert str(<div>{html.Raw('&')}</div>) == '<div>&</div>'
def render(self, context): return html.Div()( html.H1()(html.Raw('The "'), self.type, html.Raw('" list')), TodoForm(type=self.type), TodoList(todos=self.todos), )