Skip to main content

WTForms extensions for Tornado fork.

Project description

Candango Tornado WTForms

Latest PyPI version Number of PyPI downloads Build Status

WTForms extensions for Tornado forked from WTForms-Tornado.

We will derive the amazing work developed by the original project and add further improvements.

The project WTForms-Tornado will continue to be matained. Check the original project to see if it fit the needs your project/application needs.

Usage

import tornado.ioloop
import tornado.web

from wtforms.fields import IntegerField
from wtforms.validators import DataRequired
from tornado_wtforms.form import TornadoForm


class SumForm(TornadoForm):

   a = IntegerField(validators=[DataRequired()])
   b = IntegerField(validators=[DataRequired()])


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()

Backwards Compatibility

We'll keep a backwards compatibility with the WTForms-Tornado but a depreciation warning will be logged.

This still works after the instalation:

from wtforms_tornado import Form

class LegacyForm(Form):

   pass

The tornado_wtforms.from.Form class is extending wtforms.form.TornadoForm and is available to be imported at wtforms_tornado module.

Just changing wtforms_tornado by tornado_wtforms and keep importing Form won't work, from tornado_wtforms import Form, because Form is not referenced in tornado_wtforms module. Either you do from tornado_wtforms.form import TornadoForm or from tornado_wtforms.form import Form. The second option will still trigger a depreciation after instantiating a Form instance.

Installation

You can to use pip_ to install Tornado-WTForms:

$ pip install tornado-wtforms

Or using last source:

$ pip install git+git://github.com/puentesarrin/tornado-wtforms.git

Or manually, download the latest source from PyPI:

$ tar xvzf tornado-wtforms-$VERSION.tar.gz
$ cd tornado-wtforms-$VERSION
$ python setup.py build
$ sudo python setup.py install

Support

Tornado WTForms is a fork from WTForms Tornado and now is one of Candango Open Source Group initiatives and is available under Apache License, Version 2.0.

WTForms Tornado is maintained by Jorge Puente Sarrín and is available under Apache License, Version 2.0.

This web site and all documentation is licensed under Creative Commons 3.0.

Copyright (c) 2022 Flávio Gonçalves Garcia

Copyright (c) 2013-2022 Jorge Puente Sarrín

Project details


Download files

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

Source Distribution

tornado-wtforms-0.0.1.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

tornado_wtforms-0.0.1-py2.py3-none-any.whl (7.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file tornado-wtforms-0.0.1.tar.gz.

File metadata

  • Download URL: tornado-wtforms-0.0.1.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for tornado-wtforms-0.0.1.tar.gz
Algorithm Hash digest
SHA256 fcb7b8d78995e193bff1dac319c5394ea06d03c8832da760d5f657c619b94764
MD5 62bf067d4de440457dc9e994ebf74c79
BLAKE2b-256 16adb8a59e4f25dff9e464ab7a2390a52f15bec15b83cb931d1d41d4ba07d6b4

See more details on using hashes here.

File details

Details for the file tornado_wtforms-0.0.1-py2.py3-none-any.whl.

File metadata

  • Download URL: tornado_wtforms-0.0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for tornado_wtforms-0.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3efcba8be2399ae49ff368e77252dfcc3e98e5bed68de850a6473cb7ea0c5503
MD5 7136fa42aade175bbb642092641b523f
BLAKE2b-256 85b230fd3c8c54117f8f1d3051bd545316fd8275c05771070877551b460fbcf2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page