Skip to content

Commit

Permalink
[18.0][MIG] endpoint_route_handler: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cormaza committed Nov 8, 2024
1 parent 9a45aea commit 52c406f
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 37 deletions.
48 changes: 24 additions & 24 deletions endpoint_route_handler/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Endpoint route handler
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb--api-lightgray.png?logo=github
:target: https://github.com/OCA/web-api/tree/17.0/endpoint_route_handler
:target: https://github.com/OCA/web-api/tree/18.0/endpoint_route_handler
:alt: OCA/web-api
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/web-api-17-0/web-api-17-0-endpoint_route_handler
:target: https://translation.odoo-community.org/projects/web-api-18-0/web-api-18-0-endpoint_route_handler
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/web-api&target_branch=17.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/web-api&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -116,31 +116,31 @@ You can see a real life example on shopfloor.app model.
Known issues / Roadmap
======================

- add api docs helpers
- add api docs helpers

- allow multiple HTTP methods on the same endpoint
- allow multiple HTTP methods on the same endpoint

- multiple values for route and methods
- multiple values for route and methods

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

remove the route field in the table of endpoint_route
remove the route field in the table of endpoint_route

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

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

for customizing the rule behavior the endpoint the hook is to
override the registry lookup
for customizing the rule behavior the endpoint the hook is to
override the registry lookup

make EndpointRule class overridable on the registry
make EndpointRule class overridable on the registry

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

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

Expand All @@ -167,8 +167,8 @@ Authors
Contributors
------------

- Simone Orsi <[email protected]>
- Nguyen Minh Chien <[email protected]>
- Simone Orsi <[email protected]>
- Nguyen Minh Chien <[email protected]>

Maintainers
-----------
Expand All @@ -191,6 +191,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-simahawk|

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

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion endpoint_route_handler/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"name": "Endpoint route handler",
"summary": """Provide mixin and tool to generate custom endpoints on the fly.""",
"version": "17.0.1.0.2",
"version": "18.0.1.0.0",
"license": "LGPL-3",
"development_status": "Beta",
"author": "Camptocamp,Odoo Community Association (OCA)",
Expand Down
2 changes: 2 additions & 0 deletions endpoint_route_handler/models/endpoint_route_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class EndpointRouteHandler(models.AbstractModel):
compute="_compute_endpoint_hash", help="Identify the route with its main params"
)
csrf = fields.Boolean(default=False)
readonly = fields.Boolean(default=False)

# TODO: add flag to prevent route updates on save ->
# should be handled by specific actions + filter in a tree view + btn on form
Expand Down Expand Up @@ -247,5 +248,6 @@ def _get_routing_info(self):
methods=[self.request_method],
routes=[route],
csrf=self.csrf,
readonly=self.readonly,
)
return route, routing, self.endpoint_hash
21 changes: 9 additions & 12 deletions endpoint_route_handler/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -275,7 +274,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: gray; } /* line numbers */
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -301,7 +300,7 @@
span.pre {
white-space: pre }

span.problematic, pre.problematic {
span.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -369,7 +368,7 @@ <h1 class="title">Endpoint route handler</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:2fbca7b2865b964017fc753b0f6e44107ec69bbdb0b2c9f4b613292e95632ddb
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/web-api/tree/17.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-17-0/web-api-17-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=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<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/licence-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>
<p>Technical module that provides a base handler for adding and removing
controller routes on the fly.</p>
<p>Can be used as a mixin or as a tool.</p>
Expand Down Expand Up @@ -471,8 +470,8 @@ <h1><a class="toc-backref" href="#toc-entry-4">Known issues / Roadmap</a></h1>
the rule sort and freeze its values to update the endpoint hash</p>
<p>catch dup route exception on the sync to detect duplicated routes
and use the endpoint_hash to retrieve the real record (note: we
could store more info in the routing information which will stay
in the map)</p>
could store more info in the routing information which will stay in
the map)</p>
<p>for customizing the rule behavior the endpoint the hook is to
override the registry lookup</p>
<p>make EndpointRule class overridable on the registry</p>
Expand All @@ -488,7 +487,7 @@ <h1><a class="toc-backref" href="#toc-entry-5">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/web-api/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/web-api/issues/new?body=module:%20endpoint_route_handler%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<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>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand All @@ -509,15 +508,13 @@ <h2><a class="toc-backref" href="#toc-entry-8">Contributors</a></h2>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-9">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<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>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web-api/tree/17.0/endpoint_route_handler">OCA/web-api</a> project on GitHub.</p>
<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>
<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>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions endpoint_route_handler/tests/test_endpoint_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def _make_new_route(self, options=None, **kw):
vals = {
"name": "Test custom route",
"request_method": "GET",
"readonly": False,
}
vals.update(kw)
new_route = self.route_handler.new(vals)
Expand Down

0 comments on commit 52c406f

Please sign in to comment.