Skip to content
Snippets Groups Projects
Commit c58751f2 authored by Victor Feyens's avatar Victor Feyens
Browse files

[IMP] doc: controllers organisation + minor correction

parent 82a90aa2
No related branches found
No related tags found
No related merge requests found
......@@ -58,7 +58,7 @@ Although it does absolutely nothing we can install it:
To the browser
==============
:ref:`Controllers <reference/http/controllers>` interpret browser requests and
:ref:`Controllers <reference/controllers>` interpret browser requests and
send data back.
Add a simple controller and ensure it is imported by ``__init__.py`` (so
......
:banner: banners/web_controllers.jpg
.. _reference/controllers:
===============
Web Controllers
===============
.. _reference/http/routing:
Routing
=======
.. autofunction:: odoo.http.route
.. _reference/http/request:
Request
=======
The request object is automatically set on :data:`odoo.http.request` at
the start of the request
.. autoclass:: odoo.http.WebRequest
:members:
:member-order: bysource
.. autoclass:: odoo.http.HttpRequest
:members:
.. autoclass:: odoo.http.JsonRequest
:members:
Response
========
.. autoclass:: odoo.http.Response
:members:
:member-order: bysource
.. maybe set this to document all the fine methods on Werkzeug's Response
object? (it works)
:inherited-members:
.. _reference/http/controllers:
Controllers
===========
......@@ -51,11 +17,8 @@ no database created, or no database selected).
Controllers thus provide their own extension mechanism, separate from that of
models:
Controllers are created by :ref:`inheriting <python:tut-inheritance>` from
.. autoclass:: odoo.http.Controller
and defining methods decorated with :func:`~odoo.http.route`::
Controllers are created by :ref:`inheriting <python:tut-inheritance>` from :class:`~odoo.http.Controller`.
Routes are defined through methods decorated with :func:`~odoo.http.route`::
class MyController(odoo.http.Controller):
@route('/some_url', auth='public')
......@@ -85,3 +48,40 @@ class and override relevant methods, re-exposing them if necessary::
will change ``/some_url`` from public authentication to user (requiring a
log-in)
API
===
.. _reference/http/routing:
Routing
-------
.. autofunction:: odoo.http.route
.. _reference/http/request:
Request
-------
The request object is automatically set on :data:`odoo.http.request` at
the start of the request
.. autoclass:: odoo.http.WebRequest
:members:
:member-order: bysource
.. autoclass:: odoo.http.HttpRequest
:members:
.. autoclass:: odoo.http.JsonRequest
:members:
Response
--------
.. autoclass:: odoo.http.Response
:members:
:member-order: bysource
.. maybe set this to document all the fine methods on Werkzeug's Response
object? (it works)
:inherited-members:
......@@ -48,7 +48,7 @@ otherwise.
a route address to be fetched and prepended to the view.
If this attribute is set, the
:ref:`controller route url<reference/http/controllers>` will be fetched and
:ref:`controller route url<reference/controllers>` will be fetched and
displayed above the view. The json response from the controller should
contain an "html" key.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment