From b5fafb5aeb3d7a5a0e752b211a2048a2cce53821 Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Thu, 10 Dec 2015 15:51:01 +0100 Subject: [PATCH] [FIX] base: fix SignedIntConverter weight This allow to keep route with an SignedIntConverter with more priority than a StringConverter. The default wight is 100, so force the weight to 50 (default intConverter) was also a fix. But we decide to rewrite the SignedIntConverter based on the intConverter of WerkZeug. So now, a controller '/module/', will be matched after '/module/". (Same behaviour that before the commit 800ae13712e0e986f690f29ed3940410b5a750d5) --- openerp/addons/base/ir/ir_http.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/openerp/addons/base/ir/ir_http.py b/openerp/addons/base/ir/ir_http.py index 38e01d25b99..f0bfd353f33 100644 --- a/openerp/addons/base/ir/ir_http.py +++ b/openerp/addons/base/ir/ir_http.py @@ -54,18 +54,9 @@ class ModelsConverter(werkzeug.routing.BaseConverter): def to_url(self, value): return ",".join(i.id for i in value) -class SignedIntConverter(werkzeug.routing.BaseConverter): - def __init__(self, url_map): - super(SignedIntConverter, self).__init__(url_map) - - def to_python(self, value): - try: - return int(value) - except ValueError: - raise werkzeug.routing.ValidationError() - - def to_url(self, value): - return str(value) +class SignedIntConverter(werkzeug.routing.NumberConverter): + regex = r'-?\d+' + num_convert = int class ir_http(osv.AbstractModel):