Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions endpoint_route_handler/models/ir_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ def _generate_routing_rules(self, modules, converters):
self._endpoint_routing_rules(),
)

@classmethod
def _endpoint_routing_rules(cls):
def _endpoint_routing_rules(self):
"""Yield custom endpoint rules"""
e_registry = cls._endpoint_route_registry(http.request.env)
e_registry = self._endpoint_route_registry(self.env)
for endpoint_rule in e_registry.get_rules():
_logger.debug("LOADING %s", endpoint_rule)
endpoint = endpoint_rule.endpoint
Expand All @@ -43,9 +42,8 @@ def routing_map(self, key=None):
res = super().routing_map(key=key)
return res

@classmethod
def _endpoint_route_last_version(cls):
res = cls._get_routing_map_last_version(http.request.env)
def _endpoint_route_last_version(self):
res = self._get_routing_map_last_version(self.env)
return res

@classmethod
Expand Down
1 change: 1 addition & 0 deletions endpoint_route_handler/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
- Simone Orsi \<<simone.orsi@camptocamp.com>\>
- Nguyen Minh Chien \<<chien@trobz.com>\>
- Omar Assouma \<<omar.assouma@dataone.eu>\>
8 changes: 8 additions & 0 deletions endpoint_route_handler/tests/test_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ def tearDown(self):
EndpointRegistry.wipe_registry_for(self.env.cr)
super().tearDown()

def test_routing_map_no_request(self):
# Crons, `odoo shell` and core tests build the routing map with no
# request bound. website's TestWebsiteTechnicalPage does, through
# website.technical.page.get_static_routes(). No mocked request here
# on purpose.
self.env.registry.clear_cache("routing")
self.assertTrue(self.env["ir.http"].routing_map())

def test_as_tool_base_data(self):
new_route = make_new_route(self.env)
self.assertEqual(new_route.route, "/my/test/route")
Expand Down