Skip to main content
Help us improve Python packaging – donate today!

web app forms tools

Project Description

btform
=======

python web app forms tools

Code is extracted from web.py

install
=======

easy_install btform

pip install btform

example of flask
=================

#!/usr/bin/env python
#coding:utf-8

from flask import Flask
from flask import request
from btform import rules
import btform as form

app = Flask(__name__)

form1 = form.Form(
form.Textbox("name",rules.is_alphanum2(6,32),description=""),
form.Password("passwd",rules.is_alphanum2(6,32),description=""),
form.Textarea("desc",rules.len_of(1,128),description="",rows="5",),
form.Button("submit", type="submit",html="<b>submit</b>"),
)

def render_form(frm):
return "<form action='/' method='POST'>%s</form>"%frm.render()

@app.route('/', methods=['POST', 'GET'])
def hello_world():
iform = form1()
if request.method == 'GET':
return render_form(iform)
elif request.method == 'POST':
if not iform.validates(source=request.form):
return render_form(iform)
else:
return "ok"

if __name__ == '__main__':
app.run()

Release history Release notifications

This version
History Node

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
btform-0.1.linux-x86_64.tar.gz (16.2 kB) Copy SHA256 hash SHA256 Dumb Binary any Sep 16, 2015
btform-0.1-py2-none-any.whl (10.6 kB) Copy SHA256 hash SHA256 Wheel 2.7 Sep 16, 2015

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page