How to use the formencode.htmlfill.render function in FormEncode

To help you get started, we’ve selected a few FormEncode 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 Pylons / pyramid_simpleform / pyramid_simpleform / __init__.py View on Github external
def htmlfill(self, content, **htmlfill_kwargs):
        """
        Runs FormEncode **htmlfill** on content.
        """

        charset = getattr(self.request, 'charset', 'utf-8')
        htmlfill_kwargs.setdefault('encoding', charset)
        return htmlfill.render(content, 
                               defaults=self.data,
                               errors=self.errors,
                               **htmlfill_kwargs)
github pudo / databin / databin / web.py View on Github external
@app.route("/", methods=['POST'])
def post():
    try:
        paste = Paste.create(request.form, request.remote_addr)
        return redirect(url_for('view', key=paste.key))
    except Invalid, inv:
        return htmlfill.render(index(), auto_insert_errors=False,
                               defaults=request.form,
                               errors=inv.unpack_errors())
github SEL-Columbia / networkplanner / np / controllers / people.py View on Github external
def update(self):
        'Show account update page'
        # Load
        personID = h.getPersonID()
        # If the person is not logged in,
        if not personID:
            # Return
            return redirect(url('person_login', targetURL=h.encodeURL('/')))
        # Render
        c.isNew = False
        person = Session.query(model.Person).get(personID)
        # Return
        return formencode.htmlfill.render(render('/people/change.mako'), {
            'username': person.username,
            'nickname': person.nickname,
            'email': person.email,
            'email_sms': person.email_sms,
        })
github felinx / poweredsites / poweredsites / forms / base.py View on Github external
def render(self, template_name, **kwargs):
        html = self._handler.render_string(template_name, **kwargs)
        if not self._result:
            html = htmlfill.render(
                                   html,
                                   defaults=self._values,
                                   errors=self._form_errors,
                                   encoding="utf8",
            )
        self._handler.finish(html)
github pudo-attic / grano-old / grano / util.py View on Github external
def error_fill(page, values, errors):
    return htmlfill.render(page,
            defaults=values,
            errors=errors,
            auto_error_formatter=\
                lambda m: "<p class="error-message">%s</p>" % m,
            prefix_error=False,
            force_defaults=False)
github renxing / quora-python / forms.py View on Github external
def render(self, template_name, **kwargs):
        html = self._handler.render_string(template_name, **kwargs)

        if not self._result:
            html = htmlfill.render(html,
                                   defaults=self._values,
                                   errors=self._form_errors,
                                   encoding="utf8")

        self._handler.finish(html)