WTForms extensions for Tornado.
Project description
WTForms extensions for Tornado.
Usage
import tornado.ioloop import tornado.web from wtforms.fields import IntegerField from wtforms.validators import Required from wtforms_tornado import Form class SumForm(Form): a = IntegerField(validators=[Required()]) b = IntegerField(validators=[Required()]) class SumHandler(tornado.web.RequestHandler): def get(self): self.write("Hello, world") def post(self): form = SumForm(self.request.arguments) if form.validate(): self.write(str(form.data['a'] + form.data['b'])) else: self.set_status(400) self.write("" % form.errors) application = tornado.web.Application([ (r"/", SumHandler), ]) if __name__ == "__main__": application.listen(8888) tornado.ioloop.IOLoop.instance().start()
Installation
You can to use pip to install WTForms-Tornado:
$ pip install wtforms-tornado
Or using last source:
$ pip install git+git://github.com/puentesarrin/wtforms-tornado.git
Or manually, download the latest source from PyPI:
$ tar xvzf wtforms-tornado-$VERSION.tar.gz $ cd wtforms-tornado-$VERSION $ python setup.py build $ sudo python setup.py install
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 Distribution
wtforms-tornado-0.0.2.tar.gz
(3.1 kB
view details)
File details
Details for the file wtforms-tornado-0.0.2.tar.gz
.
File metadata
- Download URL: wtforms-tornado-0.0.2.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dadb5e504d01f14bf75900f592888bb402ada6b8f8235fe583359f562d351a3a |
|
MD5 | f8d4d22f3c4b060ff29b01183d8c766c |
|
BLAKE2b-256 | ce2a8d8c379606567c4968046404764572683680b96282ae87866720dcb6ca1f |