def render_GET(self, request):
     email = self.getRequestEmail(request)
     request.setHeader('content-type', 'text/html; charset=utf-8')
     element = tags.html(
         htmlHead,
         tags.body(tags.form(
             tags.fieldset(
                 tags.div(
                     tags.label('Cert e-mail'),
                     tags.label('Username', for_='username'),
                     tags.label('Password', for_='password'),
                     tags.label('Site', for_='site', class_='last'),
                     id='names',
                 ),
                 tags.div(
                     tags.input(disabled='true', value=email),
                     tags.input(name='username', type='text'),
                     tags.input(name='password', type='password'),
                     tags.input(name='site', type='url', class_='last'),
                     id='fields',
                 ),
             ),
             tags.button('Generate', type='submit'),
             action='', method='POST',
         )),
     )
     return renderElement(request, element)
Esempio n. 2
0
 def render_GET(self, request):
     body = tags.form(
         tags.label('Tahoe URI', for_='uri'), ' ',
         tags.input(id='uri', type='text', name='uri'),
         tags.br(),
         tags.label('Extension', for_='ext'), ' ',
         tags.input(id='ext', type='text', name='ext'),
         tags.br(),
         tags.input(type='submit', value='Convert to HTTP URL'),
         action='', method='POST')
     return renderElement(request, body)
Esempio n. 3
0
 def render_GET(self, request):
     body = tags.form(tags.label('Tahoe URI', for_='uri'),
                      ' ',
                      tags.input(id='uri', type='text', name='uri'),
                      tags.br(),
                      tags.label('Extension', for_='ext'),
                      ' ',
                      tags.input(id='ext', type='text', name='ext'),
                      tags.br(),
                      tags.input(type='submit',
                                 value='Convert to HTTP URL'),
                      action='',
                      method='POST')
     return renderElement(request, body)
Esempio n. 4
0
    def asTags(self):
        # type: () -> Iterable[Tag]
        """
        Convert this L{Field} into some stuff that can be rendered in a
        L{twisted.web.template}.

        @return: A new set of tags to include in a template.
        @rtype: iterable of L{twisted.web.template.Tag}
        """
        value = self.value
        if value is None:
            value = ""  # type: ignore[unreachable]
        input_tag = tags.input(type=self.formInputType,
                               name=self.formFieldName,
                               value=value)
        error_tags = []
        if self.error:
            error_tags.append(
                tags.div(class_="klein-form-validation-error")(
                    self.error.message))
        if self.formLabel:
            yield tags.label(self.formLabel, ": ", input_tag, *error_tags)
        else:
            yield input_tag
            yield error_tags