rest-framework
rest-framework copied to clipboard
base_rest: decorate service endpoints always
Decorate services' methods when the component is initialized. This way, the state of the component is the same no matter where you get it from.
@lmignon what do you think?
Note that I left it in rest.service.registration but it can be moved in utils or to a specific component.
Hi @lmignon, some modules you are maintaining are being modified, check this out!
@simahawk I'm not in favor of this change. The goal of the initial implementation is to decorate the service's methods when loading the registry. Therefore the code is called 1 time by service when a worker is initialized. Moreover the decorators are applied at class level. With your change, the code will be called each time a service is initialized (on every request) and the decorator will be applied at the instance level. For Odoo16 I would like to remove the support for non decorated methods and therefore remove this code. (I'm also thinking of removing the dependency on "component" which would greatly simplify the stack)
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.