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.8.0.tar.gz (17.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

flask_tryton-0.8.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

flask_tryton-0.8.0-py2-none-any.whl (5.9 kB view details)

Uploaded Python 2

File details

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

File metadata

  • Download URL: flask_tryton-0.8.0.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.23.3 CPython/2.7.15

File hashes

Hashes for flask_tryton-0.8.0.tar.gz
Algorithm Hash digest
SHA256 e85bf82b847c3b9141434f094a960fe951d5e61822d2ddc543523fb393831c71
MD5 086fcf220e127975a30a16a9c9381339
BLAKE2b-256 5c8b29287df4850c780923c7b4ac7c379a2e804498e11c5e4c266fe47a06788d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flask_tryton-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.23.3 CPython/2.7.15

File hashes

Hashes for flask_tryton-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b8c9e4e700576b15559fac5c25768b0df54b6c8bc1b5e0a64c753e8a918b07c0
MD5 7e03ffa9bde05832bdc3a0250e3c6f2b
BLAKE2b-256 ee9cd22d90296fdc962beb3541593bd252d49f8f75c65091da9def089d9c4433

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flask_tryton-0.8.0-py2-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.23.3 CPython/2.7.15

File hashes

Hashes for flask_tryton-0.8.0-py2-none-any.whl
Algorithm Hash digest
SHA256 7fd7c87b3587c183db65361bbd90d5df009cdee78b1fae6a4b07891202cae028
MD5 52bc0992ce67991f662fa9147d98549f
BLAKE2b-256 bbf7ed3ba2d6bfae1ed59b8d1c94dbe4ea8ba527b21dc761d191de14c5860d0d

See more details on using hashes here.

Supported by

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