Skip to main content

Adds Tryton support to Flask application

Project description

Adds Tryton support to Flask application.

By default transactions are readonly except for PUT, POST, DELETE and PATCH request methods. It provides also 2 routing converters record and records.

Nutshell

>>> from flask import Flask
>>> from flask_tryton import Tryton
>>> app = Flask(__name__)
>>> app.config['TRYTON_DATABASE'] = 'test'
>>> tryton = Tryton(app)
>>> User = tryton.pool.get('res.user')
>>> @tryton.default_context
... def default_context():
...     return User.get_preferences(context_only=True)
>>> @app.route('/')
... @tryton.transaction()
... def hello():
...     user, = User.search([('login', '=', 'admin')])
...     return '%s, Hello World!' % user.name
>>> @app.route('/user/<record("res.user"):user>')
... @tryton.transaction()
... def user(user):
...     return user.name
>>> @app.route('/users/<records("res.user"):users>')
... @tryton.transaction()
... def users(users):
...     return ', '.join(u.name for u in users)
>>> app.run()

There are three configuration options available:

  • TRYTON_DATABASE: the Tryton’s database to connect.

  • TRYTON_USER: the Tryton user id to use, by default 0 (aka root).

  • TRYTON_CONFIG: the optional path to the Tryton’s configuration.

To report issues please visit the flask_tryton bugtracker.

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

flask_tryton-0.7.tar.gz (17.4 kB view details)

Uploaded Source

Built Distributions

flask_tryton-0.7-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

flask_tryton-0.7-py2-none-any.whl (5.8 kB view details)

Uploaded Python 2

File details

Details for the file flask_tryton-0.7.tar.gz.

File metadata

  • Download URL: flask_tryton-0.7.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for flask_tryton-0.7.tar.gz
Algorithm Hash digest
SHA256 f1a269114e415ed30a769a63104ce2e60c3b00aff1b3a77826cfc8d57f8182ce
MD5 38055b8ad6e5084de5130fd61e33b697
BLAKE2b-256 713c96546dc8c7954c9c933211ec529aaac8eaab7e097a0b4d2373016b254ba2

See more details on using hashes here.

File details

Details for the file flask_tryton-0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for flask_tryton-0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 12e79467d82989fe2b70b1c11ef2f6aed589eaf741bcbbb099431b2e8328fbde
MD5 6c59a3de3f14bf56c83a4b7e1ebdae4c
BLAKE2b-256 8ba135b0fa436e2c7a0621434597049e2cb49e6099063d7171946ab0fe6d5579

See more details on using hashes here.

File details

Details for the file flask_tryton-0.7-py2-none-any.whl.

File metadata

File hashes

Hashes for flask_tryton-0.7-py2-none-any.whl
Algorithm Hash digest
SHA256 dd99a39547b691130a8ca0607f73b44bd38cf83119d0b50802c16d1d51fe3f56
MD5 d50bba08f87eb2d3ade9886b15cfe677
BLAKE2b-256 316175256970d0d40dde744d4d8f055f8b0015b0582c790aa40abac62a1fb220

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