From 4f7d833cf089c009162317df0a19b2b4feddfdfa Mon Sep 17 00:00:00 2001 From: Victor Feyens Date: Mon, 28 Feb 2022 12:22:29 +0000 Subject: [PATCH] [FIX] core: http documentation * http.py:docstring of odoo.http.route:19: WARNING: Unexpected indentation. * http.py:docstring of odoo.http.route:20: WARNING: Block quote ends without a blank line; unexpected unindent. * http.py:docstring of odoo.http.route:30: WARNING: undefined label: csrf -> No section in the doc exists with reference csrf * Add docstring for the default_lang method. closes odoo/odoo#85505 Signed-off-by: Victor Feyens (vfe) --- odoo/http.py | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/odoo/http.py b/odoo/http.py index d1ccd3bfb45..c49d73c587c 100644 --- a/odoo/http.py +++ b/odoo/http.py @@ -499,22 +499,22 @@ def route(route=None, **routing): ``'http'``. It describes where to find the request parameters and how to serialize the response. :param str auth: The authentication method, one of the following: - * ``'user'``: The user must be authenticated and the current - request will be executed using the rights of the user. - * ``'public'``: The user may or may not be authenticated. If he - isn't, the current request will be executed using the shared - Public user. - * ``'none'``: The method is always active, even if there is no - database. Mainly used by the framework and authentication - modules. There request code will not have any facilities to - access the current user. + + * ``'user'``: The user must be authenticated and the current + request will be executed using the rights of the user. + * ``'public'``: The user may or may not be authenticated. If he + isn't, the current request will be executed using the shared + Public user. + * ``'none'``: The method is always active, even if there is no + database. Mainly used by the framework and authentication + modules. The request code will not have any facilities to + access the current user. :param Iterable[str] methods: A list of http methods (verbs) this route applies to. If not specified, all methods are allowed. :param str cors: The Access-Control-Allow-Origin cors directive value. :param bool csrf: Whether CSRF protection should be enabled for the route. Enabled by default for ``'http'``-type requests, disabled - by default for ``'json'``-type requests. See - :ref:`CSRF Protection ` for more. + by default for ``'json'``-type requests. """ def decorator(endpoint): fname = f"" @@ -1062,6 +1062,11 @@ class Request: return consteq(hm, hm_expected) def default_lang(self): + """Returns default user language according to request specification + + :returns: Preferred language if specified or 'en_US' + :rtype: str + """ lang = self.httprequest.accept_languages.best if not lang: return DEFAULT_LANG