diff options
| author | Xavier Morel <xmo@odoo.com> | 2017-05-12 17:14:52 +0200 |
|---|---|---|
| committer | Xavier Morel <xmo@odoo.com> | 2017-05-15 12:26:31 +0200 |
| commit | e2f1af78c465916551f12419f37d4e63a6cfd7f2 (patch) | |
| tree | 64b5e6a05831bb5db4e32d241d90eedc2bedda7e /odoo/addons/base/tests/test_qweb.py | |
| parent | 5617d4614b4644f0eaf2feb402f0066f260200c8 (diff) | |
[FIX] P3: remove cgi.escape uses
cgi.escape is unsafe (quote=False by default) and deprecated in Python
3. We already have an openerp.tools.misc.html_escape version which
forwards to the (modern and safe) werkzeug.utils.escape, just use that
everywhere, and convert extant uses of werkzeug.utils.escape to
utils.html_escape as well so that we do the same thing everywhere.
Diffstat (limited to 'odoo/addons/base/tests/test_qweb.py')
| -rw-r--r-- | odoo/addons/base/tests/test_qweb.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/odoo/addons/base/tests/test_qweb.py b/odoo/addons/base/tests/test_qweb.py index cd459fe7669..c331f426748 100644 --- a/odoo/addons/base/tests/test_qweb.py +++ b/odoo/addons/base/tests/test_qweb.py @@ -1,19 +1,17 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -import cgi import collections import json import os.path import re from lxml import etree -from itertools import chain from odoo.modules import get_module_resource from odoo.tests.common import TransactionCase from odoo.addons.base.ir.ir_qweb import QWebException -from odoo.tools import pycompat +from odoo.tools import pycompat, misc, ustr def dedent_and_strip(string): @@ -48,12 +46,12 @@ class TestQWebTField(TransactionCase): result = self.engine.render(field, {'company': company}) self.assertEqual( - result, + ustr(result), '<span data-oe-model="res.company" data-oe-id="%d" ' 'data-oe-field="name" data-oe-type="char" ' 'data-oe-expression="company.name">%s</span>' % ( company.id, - cgi.escape(s.encode('utf-8')), + misc.html_escape(s), ), ) |
