Skip to main content

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.

Setting the configure_jinja flag adds the following filters on jinja templates: numberformat, dateformat, currencyformat and timedeltaformat. The filters apply the same formatting as Tryton reports.

Nutshell

>>> from flask import Flask
>>> from flask_tryton import Tryton
>>> app = Flask(__name__)
>>> app.config['TRYTON_DATABASE'] = 'test'
>>> tryton = Tryton(app, configure_jinja=True)
>>> 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.

Release files for flask-tryton 0.13.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flask-tryton 0.13.0
File Size Uploaded
flask_tryton-0.13.0.tar.gz 17.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flask-tryton 0.13.0
File Interpreter ABI Platform
flask_tryton-0.13.0-py3-none-any.whl Python 3 none any Details

Total release size: 35.1 kB

Release files / flask_tryton-0.13.0.tar.gz

Download URL flask_tryton-0.13.0.tar.gz
Size 17.2 kB
Tags Source
SHA-256 checksum
How to use checksums
94d8d145e77f5a6200a1bfac7fcc310103f1ba08ec26f1efefadd410f5b4671d
BLAKE2b-256 checksum
How to use checksums
11af0ad93c82141c1d8e7368e845eb87f9a9d6c305da9a36d4c79ff3f0a91fd9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release files / flask_tryton-0.13.0-py3-none-any.whl

Download URL flask_tryton-0.13.0-py3-none-any.whl
Size 18.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ed7320db3bb894a07f5db7861688d962816c742aded411cbb99f973a834c3143
BLAKE2b-256 checksum
How to use checksums
bdcf5b0746d9d5eccf832636399a3818b29635610776e74561792189ee52113a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release history Release notifications | RSS feed

This release

0.13.0 This release

2 release files

0.12.2

2 release files

0.12.0

2 release files

0.11.2

2 release files

0.11.0

2 release files

0.9.3

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.0

3 release files

0.7

3 release files

0.6

2 release files

0.5

1 release file

0.4

1 release file

0.3

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page