odoo/enterprise#80365

Created by SM Learn, Julien Castiaux (juc)
Merged at ff6d7a5bd8921982969c9012778559db4e9ab4f1

Statuses:

Linked pull requests
label
odoo-dev:master-json2rpc-juc
head
505cd44a5de7c5b8aa13f672bcca5740459cb398
merged
4 months ago by SM Learn, Julien Castiaux (juc)
odoo/odoo odoo/enterprise
master #197801 #80365

[IMP] core: forward path arguments to readonly

The signature of collable inside @route(readonly=callable) was:

class ...(http.Controller):
    def callable(self) -> bool:
        ...

It was possible to access the path, query-string and body via the globalish request object:

request.httprequest.path
request.httprequest.args
request.httprequest.get_data()

But it was not possible up to this point to get the parameters extracted from the path.

Take for example the following endpoint:

@route('/endpoint/<word>', readonly=callable)
def endpoint(self, word):
    ....

The callable function has no way to get word unless we match the endpoint again.

With this PR we change the definition of those readonly callable once again, this time to include:

  • rule: the endpoint that was matched along with its routing dictionnary (the @route extracted informations)
  • args: a dict containing the arguments extracted from the path.

task-4572591