'How should I be encoded?
@returns: one of ENCODE_URL, ENCODE_HTML_FORM, or ENCODE_KVFORM.
@change: 2.1.0 added the ENCODE_HTML_FORM response.'

def whichEncoding(self):

    if (self.request.mode in BROWSER_REQUEST_MODES):
        if ((self.fields.getOpenIDNamespace() == OPENID2_NS) and (len(self.encodeToURL()) > OPENID1_URL_LIMIT)):
            return ENCODE_HTML_FORM
        else:
            return ENCODE_URL
    else:
        return ENCODE_KVFORM
