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()
=======
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()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
btform-0.1.linux-x86_64.tar.gz
(16.2 kB
view details)
btform-0.1-py2-none-any.whl
(10.6 kB
view details)
File details
Details for the file btform-0.1.linux-x86_64.tar.gz.
File metadata
- Download URL: btform-0.1.linux-x86_64.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6fa14e8f0663c2ee525ef874d6b8bc3fa0467072a29859dd4aeb9d667e9d15d
|
|
| MD5 |
1ca0b197e065b234e780edd0c2234148
|
|
| BLAKE2b-256 |
226ab0b4cef08ea0081bef7bda2a626e0b69a96d137f2a45d96333d4b3ca4191
|
File details
Details for the file btform-0.1-py2-none-any.whl.
File metadata
- Download URL: btform-0.1-py2-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cdc889adc3eae37340639ea6ee8be46e93f2f30b7e414e9105b251cb5aa41427
|
|
| MD5 |
23a261dc4c52af32a6b424eb47993b29
|
|
| BLAKE2b-256 |
005a9d78e5cde6f9bcbd01f2d6dbcafcc8bf0e623fb751093bac97c47649bca6
|