Logo Search packages:      
Sourcecode: python-openid version File versions

def openid::message::Message::toFormMarkup (   self,
  action_url,
  form_tag_attrs = None,
  submit_text = "Continue" 
)

Generate HTML form markup that contains the values in this
message, to be HTTP POSTed as x-www-form-urlencoded UTF-8.

@param action_url: The URL to which the form will be POSTed
@type action_url: str

@param form_tag_attrs: Dictionary of attributes to be added to
    the form tag. 'accept-charset' and 'enctype' have defaults
    that can be overridden. If a value is supplied for
    'action' or 'method', it will be replaced.
@type form_tag_attrs: {unicode: unicode}

@param submit_text: The text that will appear on the submit
    button for this form.
@type submit_text: unicode

@returns: A string containing (X)HTML markup for a form that
    encodes the values in this Message object.
@rtype: str or unicode

Definition at line 274 of file message.py.

                                            :
        """Generate HTML form markup that contains the values in this
        message, to be HTTP POSTed as x-www-form-urlencoded UTF-8.

        @param action_url: The URL to which the form will be POSTed
        @type action_url: str

        @param form_tag_attrs: Dictionary of attributes to be added to
            the form tag. 'accept-charset' and 'enctype' have defaults
            that can be overridden. If a value is supplied for
            'action' or 'method', it will be replaced.
        @type form_tag_attrs: {unicode: unicode}

        @param submit_text: The text that will appear on the submit
            button for this form.
        @type submit_text: unicode

        @returns: A string containing (X)HTML markup for a form that
            encodes the values in this Message object.
        @rtype: str or unicode
        """
        if ElementTree is None:
            raise RuntimeError('This function requires ElementTree.')

        form = ElementTree.Element('form')

        if form_tag_attrs:
            for name, attr in form_tag_attrs.iteritems():
                form.attrib[name] = attr

        form.attrib['action'] = action_url
        form.attrib['method'] = 'post'
        form.attrib['accept-charset'] = 'UTF-8'
        form.attrib['enctype'] = 'application/x-www-form-urlencoded'

        for name, value in self.toPostArgs().iteritems():
            attrs = {'type': 'hidden',
                     'name': name,
                     'value': value}
            form.append(ElementTree.Element('input', attrs))

        submit = ElementTree.Element(
                'input', {'type':'submit', 'value':submit_text})
        form.append(submit)

        return ElementTree.tostring(form)

    def toURL(self, base_url):


Generated by  Doxygen 1.6.0   Back to index