[FIX] *: fix typo in route kw
The common mistake of method instead of method leads to the parameter being ignored. Add a warning to ensure no other controllers are defined this way closes odoo/odoo#71571 X-original-commit: d0048ef115985a24eec1e47ceb146f4a98f71b38 Signed-off-by: Olivier Dony (odo) <odo@openerp.com> Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
This commit is contained in:
@@ -7,7 +7,7 @@ from odoo.http import request
|
||||
|
||||
class PortalRating(http.Controller):
|
||||
|
||||
@http.route(['/website/rating/comment'], type='json', auth="user", method=['POST'], website=True)
|
||||
@http.route(['/website/rating/comment'], type='json', auth="user", methods=['POST'], website=True)
|
||||
def publish_rating_comment(self, rating_id, publisher_comment):
|
||||
rating = request.env['rating.rating'].search([('id', '=', int(rating_id))])
|
||||
if not rating:
|
||||
|
||||
@@ -514,6 +514,10 @@ def route(route=None, **kw):
|
||||
else:
|
||||
routes = [route]
|
||||
routing['routes'] = routes
|
||||
wrong = routing.pop('method', None)
|
||||
if wrong:
|
||||
kw.setdefault('methods', wrong)
|
||||
_logger.warning("<function %s.%s> defined with invalid routing parameter 'method', assuming 'methods'", f.__module__, f.__name__)
|
||||
|
||||
@functools.wraps(f)
|
||||
def response_wrap(*args, **kw):
|
||||
|
||||
Reference in New Issue
Block a user