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

For more information please visit the flask_tryton website.

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

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for flask_tryton-0.3.tar.gz
Algorithm Hash digest
SHA256 c0e9888d1f4dda9e4afd28605286afee05a20a9d8b64219af940592e70116758
MD5 7d6219522eaa847365d2a4f63bb51817
BLAKE2b-256 7a75663205c8e9c2762054a1a29a0c3897405b6bbd45200fed2984171419dc25

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