From f0235a101c4f4231f4e00ec3c9f21667c1d2d5eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 3 Jun 2016 00:02:38 +0200 Subject: [PATCH] Fix decoding test in global search In Python3, str has no more a decode method but it is the bytes type which has it. Bytes is a synonym for str in Python2, so we can use it for this test. issue5593 review25121002 --- trytond/ir/model.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trytond/ir/model.py b/trytond/ir/model.py index 9045980843..d16510447c 100644 --- a/trytond/ir/model.py +++ b/trytond/ir/model.py @@ -188,7 +188,7 @@ class Model(ModelSQL, ModelView): ]) access = ModelAccess.get_access([m.model for m in models]) s = StringMatcher() - if isinstance(text, str): + if isinstance(text, bytes): text = text.decode('utf-8') s.set_seq2(text) @@ -200,7 +200,7 @@ class Model(ModelSQL, ModelView): if not hasattr(Model, 'search_global'): continue for record, name, icon in Model.search_global(text): - if isinstance(name, str): + if isinstance(name, bytes): name = name.decode('utf-8') s.set_seq1(name) yield (s.ratio(), model.model, model.rec_name,