Skip to content

Commit 629c09c

Browse files
committed
[MIG] endpoint_route_handler: Migration to 19.0
1 parent 481eaf7 commit 629c09c

File tree

13 files changed

+61
-54
lines changed

13 files changed

+61
-54
lines changed

endpoint_route_handler/README.rst

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ Endpoint route handler
2121
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
2222
:alt: License: LGPL-3
2323
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb--api-lightgray.png?logo=github
24-
:target: https://github.com/OCA/web-api/tree/18.0/endpoint_route_handler
24+
:target: https://github.com/OCA/web-api/tree/19.0/endpoint_route_handler
2525
:alt: OCA/web-api
2626
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
27-
:target: https://translation.odoo-community.org/projects/web-api-18-0/web-api-18-0-endpoint_route_handler
27+
:target: https://translation.odoo-community.org/projects/web-api-19-0/web-api-19-0-endpoint_route_handler
2828
:alt: Translate me on Weblate
2929
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
30-
:target: https://runboat.odoo-community.org/builds?repo=OCA/web-api&target_branch=18.0
30+
:target: https://runboat.odoo-community.org/builds?repo=OCA/web-api&target_branch=19.0
3131
:alt: Try me on Runboat
3232

3333
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -120,31 +120,31 @@ You can see a real life example on shopfloor.app model.
120120
Known issues / Roadmap
121121
======================
122122

123-
- add api docs helpers
123+
- add api docs helpers
124124

125-
- allow multiple HTTP methods on the same endpoint
125+
- allow multiple HTTP methods on the same endpoint
126126

127-
- multiple values for route and methods
127+
- multiple values for route and methods
128128

129-
keep the same in the ui for now, later own we can imagine a
130-
multi-value selection or just add text field w/ proper validation
131-
and cleanup
129+
keep the same in the ui for now, later own we can imagine a
130+
multi-value selection or just add text field w/ proper validation
131+
and cleanup
132132

133-
remove the route field in the table of endpoint_route
133+
remove the route field in the table of endpoint_route
134134

135-
support a comma separated list of routes maybe support comma
136-
separated list of methods use only routing.routes for generating
137-
the rule sort and freeze its values to update the endpoint hash
135+
support a comma separated list of routes maybe support comma
136+
separated list of methods use only routing.routes for generating
137+
the rule sort and freeze its values to update the endpoint hash
138138

139-
catch dup route exception on the sync to detect duplicated routes
140-
and use the endpoint_hash to retrieve the real record (note: we
141-
could store more info in the routing information which will stay in
142-
the map)
139+
catch dup route exception on the sync to detect duplicated routes
140+
and use the endpoint_hash to retrieve the real record (note: we
141+
could store more info in the routing information which will stay
142+
in the map)
143143

144-
for customizing the rule behavior the endpoint the hook is to
145-
override the registry lookup
144+
for customizing the rule behavior the endpoint the hook is to
145+
override the registry lookup
146146

147-
make EndpointRule class overridable on the registry
147+
make EndpointRule class overridable on the registry
148148

149149
NOTE in v16 we won't care anymore about odoo controller so the lookup of
150150
the controller can be simplified to a basic py obj that holds the
@@ -156,7 +156,7 @@ Bug Tracker
156156
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web-api/issues>`_.
157157
In case of trouble, please check there if your issue has already been reported.
158158
If you spotted it first, help us to smash it by providing a detailed and welcomed
159-
`feedback <https://github.com/OCA/web-api/issues/new?body=module:%20endpoint_route_handler%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
159+
`feedback <https://github.com/OCA/web-api/issues/new?body=module:%20endpoint_route_handler%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
160160

161161
Do not contact contributors directly about support or help with technical issues.
162162

@@ -171,8 +171,8 @@ Authors
171171
Contributors
172172
------------
173173

174-
- Simone Orsi <simone.orsi@camptocamp.com>
175-
- Nguyen Minh Chien <chien@trobz.com>
174+
- Simone Orsi <simone.orsi@camptocamp.com>
175+
- Nguyen Minh Chien <chien@trobz.com>
176176

177177
Maintainers
178178
-----------
@@ -195,6 +195,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
195195

196196
|maintainer-simahawk|
197197

198-
This module is part of the `OCA/web-api <https://github.com/OCA/web-api/tree/18.0/endpoint_route_handler>`_ project on GitHub.
198+
This module is part of the `OCA/web-api <https://github.com/OCA/web-api/tree/19.0/endpoint_route_handler>`_ project on GitHub.
199199

200200
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

endpoint_route_handler/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
from . import models
2+
from . import wizard
23
from .post_init_hook import post_init_hook

endpoint_route_handler/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{
55
"name": "Endpoint route handler",
66
"summary": """Provide mixin and tool to generate custom endpoints on the fly.""",
7-
"version": "18.0.1.1.0",
7+
"version": "19.0.1.0.0",
88
"license": "LGPL-3",
99
"development_status": "Beta",
1010
"author": "Camptocamp,Odoo Community Association (OCA)",
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
from . import endpoint_route_sync_mixin
2-
from . import endpoint_route_handler
3-
from . import endpoint_route_handler_tool
41
from . import ir_http

endpoint_route_handler/models/ir_http.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ def _endpoint_routing_rules(cls):
3838
for url in endpoint_rule.routing["routes"]:
3939
yield (url, endpoint)
4040

41-
@tools.ormcache("key", "cls._endpoint_route_last_version()", cache="routing")
42-
def routing_map(cls, key=None):
41+
@tools.ormcache("key", "self._endpoint_route_last_version()", cache="routing")
42+
def routing_map(self, key=None):
4343
res = super().routing_map(key=key)
4444
return res
4545

endpoint_route_handler/registry.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,14 @@ def _setup_db(cls, cr):
103103
def _setup_db_table(cls, cr):
104104
"""Create routing table and indexes"""
105105
tools.sql.create_model_table(cr, cls._table, columns=cls._columns)
106-
tools.sql.create_unique_index(
106+
tools.sql.create_index(
107107
cr,
108108
"endpoint_route__key_uniq",
109109
cls._table,
110110
[
111111
"key",
112112
],
113+
unique=True,
113114
)
114115
tools.sql.add_constraint(
115116
cr,

endpoint_route_handler/static/description/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ <h1>Endpoint route handler</h1>
374374
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
375375
!! source digest: sha256:b9dd15b039dbf78d7a01947b6f273b1487a97ce0911b41b0b5652b2dbbb38456
376376
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
377-
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/license-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/web-api/tree/18.0/endpoint_route_handler"><img alt="OCA/web-api" src="https://img.shields.io/badge/github-OCA%2Fweb--api-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/web-api-18-0/web-api-18-0-endpoint_route_handler"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/web-api&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
377+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/license-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/web-api/tree/19.0/endpoint_route_handler"><img alt="OCA/web-api" src="https://img.shields.io/badge/github-OCA%2Fweb--api-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/web-api-19-0/web-api-19-0-endpoint_route_handler"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/web-api&amp;target_branch=19.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
378378
<p>Technical module that provides a base handler for adding and removing
379379
controller routes on the fly.</p>
380380
<p>Can be used as a mixin or as a tool.</p>
@@ -476,8 +476,8 @@ <h2><a class="toc-backref" href="#toc-entry-4">Known issues / Roadmap</a></h2>
476476
the rule sort and freeze its values to update the endpoint hash</p>
477477
<p>catch dup route exception on the sync to detect duplicated routes
478478
and use the endpoint_hash to retrieve the real record (note: we
479-
could store more info in the routing information which will stay in
480-
the map)</p>
479+
could store more info in the routing information which will stay
480+
in the map)</p>
481481
<p>for customizing the rule behavior the endpoint the hook is to
482482
override the registry lookup</p>
483483
<p>make EndpointRule class overridable on the registry</p>
@@ -493,7 +493,7 @@ <h2><a class="toc-backref" href="#toc-entry-5">Bug Tracker</a></h2>
493493
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/web-api/issues">GitHub Issues</a>.
494494
In case of trouble, please check there if your issue has already been reported.
495495
If you spotted it first, help us to smash it by providing a detailed and welcomed
496-
<a class="reference external" href="https://github.com/OCA/web-api/issues/new?body=module:%20endpoint_route_handler%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
496+
<a class="reference external" href="https://github.com/OCA/web-api/issues/new?body=module:%20endpoint_route_handler%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
497497
<p>Do not contact contributors directly about support or help with technical issues.</p>
498498
</div>
499499
<div class="section" id="credits">
@@ -522,7 +522,7 @@ <h3><a class="toc-backref" href="#toc-entry-9">Maintainers</a></h3>
522522
promote its widespread use.</p>
523523
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
524524
<p><a class="reference external image-reference" href="https://github.com/simahawk"><img alt="simahawk" src="https://github.com/simahawk.png?size=40px" /></a></p>
525-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web-api/tree/18.0/endpoint_route_handler">OCA/web-api</a> project on GitHub.</p>
525+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web-api/tree/19.0/endpoint_route_handler">OCA/web-api</a> project on GitHub.</p>
526526
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
527527
</div>
528528
</div>

endpoint_route_handler/tests/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from odoo.tests.common import TransactionCase, tagged
88
from odoo.tools import DotDict
99

10-
from odoo.addons.website.tools import MockRequest
10+
from odoo.addons.http_routing.tests.common import MockRequest
1111

1212

1313
@tagged("-at_install", "post_install")

endpoint_route_handler/tests/test_endpoint.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
44
from contextlib import contextmanager
55

6-
import odoo
6+
from odoo import api, modules
7+
from odoo.tests import common
78
from odoo.tools import mute_logger
89

910
from ..registry import EndpointRegistry
@@ -14,11 +15,11 @@
1415
@contextmanager
1516
def new_rollbacked_env():
1617
# Borrowed from `component`
17-
registry = odoo.modules.registry.Registry(odoo.tests.common.get_db_name())
18-
uid = odoo.SUPERUSER_ID
18+
registry = modules.registry.Registry(common.get_db_name())
19+
uid = api.SUPERUSER_ID
1920
cr = registry.cursor()
2021
try:
21-
yield odoo.api.Environment(cr, uid, {})
22+
yield api.Environment(cr, uid, {})
2223
finally:
2324
cr.rollback() # we shouldn't have to commit anything
2425
cr.close()
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from . import endpoint_route_sync_mixin
2+
from . import endpoint_route_handler
3+
from . import endpoint_route_handler_tool

0 commit comments

Comments
 (0)