Esempio n. 1
0
    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")),
                         )
Esempio n. 2
0
 def render(self, context):
     css = html.Raw(TYPESET_CSS)
     return html.Style(type="text/css")(css) if self.with_tag else css
Esempio n. 3
0
 def render_style(self, context):
     return <CSSCollector.Collect>{html.Raw(".content { margin: 15px; }")}
     </CSSCollector.Collect>
Esempio n. 4
0
 def render(self, context):
     return <CSSCollector.Collect namespace="bar">{html.Raw(
         "C3Collect%sBar" % self.id
     )}</CSSCollector.Collect>
Esempio n. 5
0
 def render(self, context):
     return <CSSCollector.Collect>{html.Raw("C2Collect%sDefault" % self.id)}</CSSCollector.Collect>
Esempio n. 6
0
 def render(self, context):
     js = html.Raw(JS)
     return html.Script(
         type="text/javascript")(html.Raw(js)) if self.with_tag else js
Esempio n. 7
0
def test_escaping():
    assert str(<div class="&">&{'&'}</div>) == '<div class="&amp;">&&amp;</div>'
    assert str(<div>{html.Raw('&')}</div>) == '<div>&</div>'
Esempio n. 8
0
 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),
     )