flask-tryton


Nameflask-tryton JSON
Version 0.11.2 PyPI version JSON
download
home_pagehttps://pypi.org/project/flask-tryton/
SummaryAdds Tryton support to Flask application
upload_time2023-12-23 13:57:56
maintainer
docs_urlNone
authorTryton
requires_python>=3.5
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": "",
    "docs_url": null,
    "requires_python": ">=3.5",
    "maintainer_email": "",
    "keywords": "flask tryton web",
    "author": "Tryton",
    "author_email": "foundation@tryton.org",
    "download_url": "https://files.pythonhosted.org/packages/f0/bd/64fcb1daab6be7582d35709267cb1828083089db02bed42b224bf318b417/flask_tryton-0.11.2.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.11.2",
    "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": "7172e88c48e98e7b3a474709a514fad5993cdb7dfb54a6e1ebea2c0ae5e70d95",
                "md5": "cd5b5bb59cd3f88efff1eac70ea0ff0f",
                "sha256": "2f03b3e2963355c5171235b0174094cb168c26fdfe507316729a8425a9b61188"
            },
            "downloads": -1,
            "filename": "flask_tryton-0.11.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cd5b5bb59cd3f88efff1eac70ea0ff0f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.5",
            "size": 17235,
            "upload_time": "2023-12-23T13:57:54",
            "upload_time_iso_8601": "2023-12-23T13:57:54.180521Z",
            "url": "https://files.pythonhosted.org/packages/71/72/e88c48e98e7b3a474709a514fad5993cdb7dfb54a6e1ebea2c0ae5e70d95/flask_tryton-0.11.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f0bd64fcb1daab6be7582d35709267cb1828083089db02bed42b224bf318b417",
                "md5": "b0cfa55b1a74d072406706f425463e21",
                "sha256": "ff8e6bce8935bb83e5eeca6a33dae31f96ccdc606b2ac0cc09c15b9e095417a9"
            },
            "downloads": -1,
            "filename": "flask_tryton-0.11.2.tar.gz",
            "has_sig": false,
            "md5_digest": "b0cfa55b1a74d072406706f425463e21",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.5",
            "size": 19407,
            "upload_time": "2023-12-23T13:57:56",
            "upload_time_iso_8601": "2023-12-23T13:57:56.056423Z",
            "url": "https://files.pythonhosted.org/packages/f0/bd/64fcb1daab6be7582d35709267cb1828083089db02bed42b224bf318b417/flask_tryton-0.11.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-23 13:57:56",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "flask-tryton"
}
        
Elapsed time: 0.15873s