Adds Tryton support to Falcon application
Project description
Falcon-Tryton
Adds Tryton support to Falcon application.
#! -*- coding: utf8 -*-
from functools import wraps
from falcon_tryton import Tryton
import falcon
import os
CONTEXT = None
CONFIG = {}
CONFIG['TRYTON_DATABASE'] = os.environ.get('DB_NAME', 'mydb')
CONFIG['TRYTON_USER'] = 0
app = falcon.App()
tryton = Tryton(app, CONFIG)
User = tryton.pool.get('res.user')
# @tryton.default_context
# def default_context():
# global CONTEXT
# if not CONTEXT:
# CONTEXT = User.get_preferences(context_only=True)
# return CONTEXT
class ApiUser:
@tryton.transaction()
def on_get(self, req, resp):
resp.status = falcon.HTTP_200
users = User.browse([1])
resp.media = {'name':users[0].name}
apiuser = ApiUser()
app.add_route("/user", apiuser)
# wsgi gunicorn o uwsgi:
""" example file wsgi_falcon.py:
from app_falcon import app
"""
# important: no use 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 default0(akaroot).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
falcon_tryton-0.1.3.tar.gz
(17.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file falcon_tryton-0.1.3.tar.gz.
File metadata
- Download URL: falcon_tryton-0.1.3.tar.gz
- Upload date:
- Size: 17.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a68a705536d5cdc15a86be6ab2d021ba6bd8f9cfa5b0810d4639ace78dd8c7a
|
|
| MD5 |
8b45058838e4fad9de2445051a3abb4a
|
|
| BLAKE2b-256 |
9fd98fce7b15c5f9ea5fd98bb23a704f3f334326ab12273f9a416bdff363a5b6
|
File details
Details for the file falcon_tryton-0.1.3-py3-none-any.whl.
File metadata
- Download URL: falcon_tryton-0.1.3-py3-none-any.whl
- Upload date:
- Size: 17.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a936cb0ae03b76ad054f79179c042db01ca398aceb8c520a144e29ac987eecd1
|
|
| MD5 |
9dacad023d41fc8271892cde62800c19
|
|
| BLAKE2b-256 |
174f72319f3959b1df99a51430f5299b9c847411f27e9a44db0035799f9fcf6c
|