flask-tryton


Nameflask-tryton JSON
Version 0.12.1 PyPI version JSON
download
home_pagehttps://pypi.org/project/flask-tryton/
SummaryAdds Tryton support to Flask application
upload_time2024-11-09 11:22:55
maintainerNone
docs_urlNone
authorTryton
requires_python>=3.6
licenseGPL-3
keywords flask tryton web
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Flask-Tryton
============

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`_.

.. _flask_tryton bugtracker: http://bugs.tryton.org/flask-tryton

            

Raw data

            {
    "_id": null,
    "home_page": "https://pypi.org/project/flask-tryton/",
    "name": "flask-tryton",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "flask tryton web",
    "author": "Tryton",
    "author_email": "foundation@tryton.org",
    "download_url": "https://files.pythonhosted.org/packages/f0/93/748a12149e6a7040d3150bc1a4d930481de75ed7b17535c6d73f49bd68b4/flask_tryton-0.12.1.tar.gz",
    "platform": "any",
    "description": "Flask-Tryton\n============\n\nAdds Tryton support to Flask application.\n\nBy default transactions are readonly except for PUT, POST, DELETE and PATCH\nrequest methods.\nIt provides also 2 routing converters `record` and `records`.\n\nSetting the `configure_jinja` flag adds the following filters on jinja\ntemplates: `numberformat`, `dateformat`, `currencyformat` and\n`timedeltaformat`. The filters apply the same formatting as Tryton reports.\n\nNutshell\n--------\n\n>>> from flask import Flask\n>>> from flask_tryton import Tryton\n>>> app = Flask(__name__)\n>>> app.config['TRYTON_DATABASE'] = 'test'\n>>> tryton = Tryton(app, configure_jinja=True)\n>>> User = tryton.pool.get('res.user')\n>>> @tryton.default_context\n... def default_context():\n...     return User.get_preferences(context_only=True)\n>>> @app.route('/')\n... @tryton.transaction()\n... def hello():\n...     user, = User.search([('login', '=', 'admin')])\n...     return '%s, Hello World!' % user.name\n>>> @app.route('/user/<record(\"res.user\"):user>')\n... @tryton.transaction()\n... def user(user):\n...     return user.name\n>>> @app.route('/users/<records(\"res.user\"):users>')\n... @tryton.transaction()\n... def users(users):\n...     return ', '.join(u.name for u in users)\n>>> app.run()\n\nThere are three configuration options available:\n\n* `TRYTON_DATABASE`: the Tryton's database to connect.\n* `TRYTON_USER`: the Tryton user id to use, by default `0` (aka `root`).\n* `TRYTON_CONFIG`: the optional path to the Tryton's configuration.\n\nTo report issues please visit the `flask_tryton bugtracker`_.\n\n.. _flask_tryton bugtracker: http://bugs.tryton.org/flask-tryton\n",
    "bugtrack_url": null,
    "license": "GPL-3",
    "summary": "Adds Tryton support to Flask application",
    "version": "0.12.1",
    "project_urls": {
        "Bug Tracker": "https://bugs.tryton.org/flask-tryton",
        "Download": "https://downloads.tryton.org/flask-tryton/",
        "Forum": "https://discuss.tryton.org/tags/flask",
        "Homepage": "https://pypi.org/project/flask-tryton/",
        "Source Code": "https://code.tryton.org/flask-tryton"
    },
    "split_keywords": [
        "flask",
        "tryton",
        "web"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "754c7ef7e6c6182c9716bb90d37b194df7caacff9bce2fc732e569b8e1be12e8",
                "md5": "bdf36e7fcf3fe0253763c739eedd4b31",
                "sha256": "1b09053f594f53c62d782f61d8d656f5d1925945c7f05f05461dca22866a8ae8"
            },
            "downloads": -1,
            "filename": "flask_tryton-0.12.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bdf36e7fcf3fe0253763c739eedd4b31",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 17142,
            "upload_time": "2024-11-09T11:22:54",
            "upload_time_iso_8601": "2024-11-09T11:22:54.114761Z",
            "url": "https://files.pythonhosted.org/packages/75/4c/7ef7e6c6182c9716bb90d37b194df7caacff9bce2fc732e569b8e1be12e8/flask_tryton-0.12.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f093748a12149e6a7040d3150bc1a4d930481de75ed7b17535c6d73f49bd68b4",
                "md5": "8952e591d36c758dfb10f1de2f7cad51",
                "sha256": "e243d45f4827522ce137be4307f7de677fcdf16e01bde39fe3a4859205100cd9"
            },
            "downloads": -1,
            "filename": "flask_tryton-0.12.1.tar.gz",
            "has_sig": false,
            "md5_digest": "8952e591d36c758dfb10f1de2f7cad51",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 19474,
            "upload_time": "2024-11-09T11:22:55",
            "upload_time_iso_8601": "2024-11-09T11:22:55.914410Z",
            "url": "https://files.pythonhosted.org/packages/f0/93/748a12149e6a7040d3150bc1a4d930481de75ed7b17535c6d73f49bd68b4/flask_tryton-0.12.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-09 11:22:55",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "flask-tryton"
}
        
Elapsed time: 0.36950s