How to use the klein.Form function in klein

To help you get started, we’ve selected a few klein examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github twisted / klein / loginspike.py View on Github external
    form=Form.rendererFor(logOtherOut, action="/sessions/logout"),
    binding=Authorization(ISimpleAccountBinding, required=False),
    session=RequestComponent(ISession),
)
@inlineCallbacks
def sessions(binding, form, session):
    # type: (ISimpleAccountBinding, Form, ISession) -> Deferred
    if binding is None:
        returnValue({"sessions": []})
    else:
        dump = {
            "sessions": [
                oneSession.widget(
                    session_info, form, session.identifier == session_info.id
                )
                for session_info in (yield binding.boundSessionInformation())
            ]
github twisted / klein / loginspike.py View on Github external
    chirp_form=Form.rendererFor(addChirp, "/chirp")
)
def root(chirp_form, account):
    # type: (Chirper, ISimpleAccount) -> Dict
    return {
        "result": "hello world",
        "homeActive": "active",
        "chirp_form": chirp_form if account is not None else u"",
    }
github twisted / klein / docs / introduction / codeexamples / forms.py View on Github external
    theForm=Form.rendererFor(postHandler, action=u"/?post=yes")
)
def formRenderer(theForm):
    return {"anForm": theForm}