[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/<string:xmlid>', will be matched after
'/module/<int:id>". (Same behaviour that before the commit 800ae13712)
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user