Fix coding for StringMatcher in global_search
StringMatcher requires to have the same type of strings issue3029 review696002
This commit is contained in:
1 parent
511e78e6fa
commit
7bea08c745
1 file changed
+5
-1
+5
-1
@@ -134,7 +134,9 @@ class Model(ModelSQL, ModelView):
|
||||
])
|
||||
access = ModelAccess.get_access([m.model for m in models])
|
||||
s = StringMatcher()
|
||||
s.set_seq2(text.decode('utf-8'))
|
||||
if isinstance(text, str):
|
||||
text = text.decode('utf-8')
|
||||
s.set_seq2(text)
|
||||
|
||||
def generate():
|
||||
for model in models:
|
||||
@@ -144,6 +146,8 @@ class Model(ModelSQL, ModelView):
|
||||
if not hasattr(Model, 'search_global'):
|
||||
continue
|
||||
for id_, rec_name, icon in Model.search_global(text):
|
||||
if isinstance(rec_name, str):
|
||||
rec_name = rec_name.decode('utf-8')
|
||||
s.set_seq1(rec_name)
|
||||
yield (s.ratio(), model.model, model.rec_name,
|
||||
id_, rec_name, icon)
|
||||
|
||||
Reference in new issue
Block a user