Esempio n. 1
0
 def render(self, request):
     if self.widget_type == "multiple_select":
         multiple = "multiple"
     else:
         multiple = None
     if self.widget_type == "option_select":
         onchange = "submit()"
     else:
         onchange = None
     tags = [
         htmltag(
             "select",
             name=self.name,
             multiple=multiple,
             onchange=onchange,
             size=self.size,
         )
     ]
     for object, description, key in self.options:
         if self.is_selected(object):
             selected = "selected"
         else:
             selected = None
         if description is None:
             description = ""
         r = htmltag("option", value=key, selected=selected)
         tags.append(r + htmlescape(description) + htmltext('</option>'))
     tags.append(htmltext("</select>"))
     return htmltext("\n").join(tags)
Esempio n. 2
0
 def render_content(self):
     tags = [htmltag("select", name=self.name, **self.attrs)]
     for object, description, key in self.options:
         if self.is_selected(object):
             selected = 'selected'
         else:
             selected = None
         if description is None:
             description = ""
         r = htmltag("option", value=key, selected=selected)
         tags.append(r + htmlescape(description) + htmltext('</option>'))
     tags.append(htmltext("</select>"))
     return htmltext("\n").join(tags)
Esempio n. 3
0
 def render_content(self):
     tags = [htmltag("select", name=self.name, **self.attrs)]
     for object, description, key in self.options:
         if self.is_selected(object):
             selected = 'selected'
         else:
             selected = None
         if description is None:
             description = ""
         r = htmltag("option", value=key, selected=selected)
         tags.append(r + htmlescape(description) + htmltext('</option>'))
     tags.append(htmltext("</select>"))
     return htmltext("\n").join(tags)
Esempio n. 4
0
 def render(self, request):
     return htmltag("input",
                    xml_end=1,
                    type="checkbox",
                    name=self.name,
                    value="yes",
                    checked=self.value and "checked" or None)
Esempio n. 5
0
 def render_content(self):
     return htmltag("input",
                    xml_end=True,
                    type=self.HTML_TYPE,
                    name=self.name,
                    value=self.value,
                    **self.attrs)
Esempio n. 6
0
 def _render_start(self):
     r = TemplateIO(html=True)
     r += htmltag('form', method=self.method,
                  enctype=self.enctype, action=self.action,
                  **self.attrs)
     r += self._render_hidden_widgets()
     return r.getvalue()
Esempio n. 7
0
 def render_content(self):
     return htmltag("input", xml_end=True,
                    type="checkbox",
                    name=self.name,
                    value="yes",
                    checked=self.value and "checked" or None,
                    **self.attrs)
Esempio n. 8
0
 def render(self, request):
     value = (self.value and htmlescape(self.value) or None)
     return htmltag("input",
                    xml_end=1,
                    type="submit",
                    name=self.name,
                    value=value)
Esempio n. 9
0
 def _render_start(self, request, action,
                   enctype=None, method='post', name=None):
     r = TemplateIO(html=1)
     r += htmltag('form', enctype=enctype, method=method,
                  action=action, name=name)
     r += self._render_hidden_widgets(request)
     return r.getvalue()
Esempio n. 10
0
 def _render_start(self):
     r = TemplateIO(html=True)
     r += htmltag('form', name=self.name, method=self.method,
                  enctype=self.enctype, action=self.action_url,
                  **self.attrs)
     r += self._render_hidden_widgets()
     return r.getvalue()
Esempio n. 11
0
 def render(self, request, **attributes):
     return htmltag("input", xml_end=1,
                    type=self.html_type,
                    name=self.name,
                    size=self.size,
                    maxlength=self.maxlength,
                    value=self.value,
                    **attributes)
Esempio n. 12
0
 def render_content(self):
     return htmltag("input",
                    xml_end=True,
                    type="checkbox",
                    name=self.name,
                    value="yes",
                    checked=self.value and "checked" or None,
                    **self.attrs)
Esempio n. 13
0
 def render(self, request):
     return (htmltag("textarea", name=self.name,
                     cols=self.cols,
                     rows=self.rows,
                     wrap=self.wrap,
                     css_class=self.css_class) +
             htmlescape(self.value or "") +
             htmltext("</textarea>"))
Esempio n. 14
0
 def render(self, request):
     return (htmltag("textarea", name=self.name,
                     cols=self.cols,
                     rows=self.rows,
                     wrap=self.wrap,
                     css_class=self.css_class) +
             htmlescape(self.value or "") +
             htmltext("</textarea>"))
Esempio n. 15
0
 def render_content(self):
     # slightly different behavior here, we always render the
     # tag using the 'value' passed in as a parameter.  'self.value'
     # is a boolean that is true if the button's name appears
     # in the request.
     value = (self.label and htmlescape(self.label) or None)
     return htmltag("input", xml_end=True, type=self.HTML_TYPE,
                    name=self.name, value=value, **self.attrs)
Esempio n. 16
0
 def render(self, request):
     if self.value is None:
         value = None
     else:
         value = htmlescape(self.value)
     return htmltag(
         "input", xml_end=1, type="hidden", name=self.name, value=value
     )
Esempio n. 17
0
 def render(self, request, **attributes):
     return htmltag("input", xml_end=1,
                    type=self.html_type,
                    name=self.name,
                    size=self.size,
                    maxlength=self.maxlength,
                    value=self.value,
                    **attributes)
Esempio n. 18
0
 def render(self, request):
     if self.value is None:
         value = None
     else:
         value = htmlescape(self.value)
     return htmltag("input", xml_end=1,
                    type="hidden",
                    name=self.name,
                    value=value)
Esempio n. 19
0
 def render_content(self):
     if self.value is None:
         value = None
     else:
         value = htmlescape(self.value)
     return htmltag("input", xml_end=True,
                    type="hidden",
                    name=self.name,
                    value=value,
                    **self.attrs)
Esempio n. 20
0
 def render_content(self):
     if self.value is None:
         value = None
     else:
         value = htmlescape(self.value)
     return htmltag("input",
                    xml_end=True,
                    type="hidden",
                    name=self.name,
                    value=value,
                    **self.attrs)
Esempio n. 21
0
 def render_content(self):
     # slightly different behavior here, we always render the
     # tag using the 'value' passed in as a parameter.  'self.value'
     # is a boolean that is true if the button's name appears
     # in the request.
     value = (self.label and htmlescape(self.label) or None)
     return htmltag("input",
                    xml_end=True,
                    type=self.HTML_TYPE,
                    name=self.name,
                    value=value,
                    **self.attrs)
Esempio n. 22
0
 def render(self, request):
     tags = []
     for object, description, key in self.options:
         if self.is_selected(object):
             checked = ValuelessAttr
         else:
             checked = None
         r = htmltag("input", xml_end=True,
                     type="radio",
                     name=self.name,
                     value=key,
                     checked=checked)
         tags.append(r + htmlescape(description))
     return htmlescape(self.delim).join(tags)
Esempio n. 23
0
 def render(self, request):
     if self.widget_type == "multiple_select":
         multiple = ValuelessAttr
     else:
         multiple = None
     if self.widget_type == "option_select":
         onchange = "submit()"
     else:
         onchange = None
     tags = [htmltag("select", name=self.name,
                     multiple=multiple, onchange=onchange,
                     size=self.size)]
     for object, description, key in self.options:
         if self.is_selected(object):
             selected = ValuelessAttr
         else:
             selected = None
         if description is None:
             description = ""
         r = htmltag("option", value=key, selected=selected)
         tags.append(r + htmlescape(description) + htmltext('</option>'))
     tags.append(htmltext("</select>"))
     return htmltext("\n").join(tags)
Esempio n. 24
0
 def render(self, request):
     tags = []
     for object, description, key in self.options:
         if self.is_selected(object):
             checked = "checked"
         else:
             checked = None
         r = htmltag("input", xml_end=True,
                     type="radio",
                     name=self.name,
                     value=key,
                     checked=checked)
         tags.append(r + htmlescape(description))
     return htmlescape(self.delim).join(tags)
Esempio n. 25
0
 def render_content(self):
     tags = []
     for object, description, key in self.options:
         if self.is_selected(object):
             checked = 'checked'
         else:
             checked = None
         r = htmltag("input", xml_end=True,
                     type="radio",
                     name=self.name,
                     value=key,
                     checked=checked,
                     **self.attrs)
         tags.append(r + htmlescape(description))
     return htmlescape(self.delim).join(tags)
Esempio n. 26
0
 def render_content(self):
     tags = []
     for object, description, key in self.options:
         if self.is_selected(object):
             checked = 'checked'
         else:
             checked = None
         r = htmltag(
             "input",
             xml_end=True,
             type="radio",
             name=self.name,
             value=key,
             checked=checked,
             **self.attrs,
         )
         tags.append(r + htmlescape(description))
     return htmlescape(self.delim).join(tags)
Esempio n. 27
0
 def render_content(self):
     return htmltag("input", xml_end=True,
                    type=self.HTML_TYPE,
                    name=self.name,
                    value=self.value,
                    **self.attrs)
Esempio n. 28
0
 def render_content(self):
     return (htmltag("textarea", name=self.name, **self.attrs) +
             htmlescape(self.value or "") +
             htmltext("</textarea>"))
Esempio n. 29
0
 def render(self, request):
     value = (self.value and htmlescape(self.value) or None)
     return htmltag("input", xml_end=1, type="submit",
                    name=self.name, value=value)
Esempio n. 30
0
 def render(self, request):
     return htmltag("input", xml_end=1,
                    type="checkbox",
                    name=self.name,
                    value="yes",
                    checked=self.value and ValuelessAttr or None)
Esempio n. 31
0
 def render_content(self):
     return (htmltag("textarea", name=self.name, **self.attrs) +
             htmlescape(self.value or "") + htmltext("</textarea>"))