Skip to content

Commit 4bade48

Browse files
committed
[FIX] util/domains: deprecation of ustr
Since it's only used to str-ify exceptions, this can just use the underlying `exception_to_unicode`, which [has existed][1] for longer than [`ustr` has used it][2] Related to odoo/odoo#173811 [1]: odoo/odoo@195fc4a [2]: odoo/odoo@8f81995 closes #118 Related: odoo/enterprise#66986 Signed-off-by: Christophe Simonis (chs) <[email protected]>
1 parent 630a1ef commit 4bade48

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/util/domains.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525

2626
try:
2727
from odoo.osv import expression
28-
from odoo.tools import ustr
28+
from odoo.tools import exception_to_unicode
2929
from odoo.tools.safe_eval import safe_eval
3030
except ImportError:
3131
from openerp.osv import expression
32-
from openerp.tools import ustr
32+
from openerp.tools import exception_to_unicode
3333
from openerp.tools.safe_eval import safe_eval
3434

3535
from .const import NEARLYWARN
@@ -202,14 +202,14 @@ def _adapt_one_domain(cr, target_model, old, new, model, domain, adapter=None, f
202202
try:
203203
eval_dom = expression.normalize_domain(safe_eval(domain, evaluation_context, nocopy=True))
204204
except Exception as e:
205-
oops = ustr(e)
205+
oops = exception_to_unicode(e)
206206
_logger.log(NEARLYWARN, "Cannot evaluate %r domain: %r: %s", model, domain, oops)
207207
return None
208208
else:
209209
try:
210210
eval_dom = expression.normalize_domain(domain)
211211
except Exception as e:
212-
oops = ustr(e)
212+
oops = exception_to_unicode(e)
213213
_logger.log(NEARLYWARN, "Invalid %r domain: %r: %s", model, domain, oops)
214214
return None
215215

0 commit comments

Comments
 (0)