Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

simahawk
Copy link

@simahawk simahawk commented Sep 19, 2025

Backport of OCA/shopfloor-app#19

shopfloor_base: fix _registered_endpoint_rule_keys

This was breaking _unregister_controllers since we don't get tuples
but EndpointRule objects.

Prior to this change the call failed like

  File /odoo/external-src/shopfloor-app/shopfloor_base/models/shopfloor_app.py, line 166, in _registered_endpoint_rule_keys
    return [x[0] for x in self._registered_routes()]
            ~^^^
TypeError: 'EndpointRule' object is not subscriptable

How to reproduce: archive an app and sync registry (or directly call the method on an existing active app).

shopfloor_base: fix routing registration (the most important fix)

This prevented the usage of the fastapi dispatcher leading - among other things - to broken handling of server side errors as exceptions are not wrapped.

How to reproduce: raise an exception server side (eg: override the 1st method of a scenario to raise an exception in any case) and see on the screen an alert w/ "undefined undefined" instead of a nice error message.

TODO

@lmignon I have no time to test this on 16 so I simply backported the fixes. Could you have a look?
Migrations scripts should be also ported (w/o the "readonly" flag) iif the issue is confirmed as all the existing routes should be updated.

This was breaking _unregister_controllers since we don't get tuples
but EndpointRule objects.

Prior to this change the call failed like

  File /odoo/external-src/shopfloor-app/shopfloor_base/models/shopfloor_app.py, line 166, in _registered_endpoint_rule_keys
    return [x[0] for x in self._registered_routes()]
            ~^^^
TypeError: 'EndpointRule' object is not subscriptable
* ensure manifest url is always the same
* improve comparison on handler options
The app was not using at all the base_rest dispatcher for restapi route type.
This is because by default endpoint.route.handler use only http or json
@OCA-git-bot
Copy link
Contributor

Hi @sebalix, @guewen,
some modules you are maintaining are being modified, check this out!

@lmignon
Copy link

lmignon commented Sep 22, 2025

Thank you @simahawk. I take this PR on my TODO list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants