diff options
| author | Adrian Torres <adt@odoo.com> | 2018-11-08 15:27:30 +0000 |
|---|---|---|
| committer | Adrian Torres <adt@odoo.com> | 2018-11-29 09:28:17 +0000 |
| commit | 52f5528cfb6d1152ee226e268247dc685a8ba329 (patch) | |
| tree | b44ecfa477b50dd3e488f09f623eecc8bc8e9d7d /doc/_extensions/odoo_ext/translator.py | |
| parent | e5c864a596b72515837f0ed1e07550398ecc1ab0 (diff) | |
[REF] *: replace deprecated pycompat helpers for builtins
This commit replaces calls to pycompat helpers that were intended for
python 2 <-> python 3 interoperability for python 3 builtins, as python
2 is no longer officially supported by Odoo.
This includes:
* calls to imap/izip/ifilter replaced by map/zip/filter
* uses of text_type replaced by str
* uses of unichr replaced by chr
* calls to implements_to_string, implements_iterator removed
* string_types and integer_types replaced by str, int respectively
* calls to to_native replaced by calls to to_text
This is done in preparation to the removal of these deprecated helpers
in the following commit.
Diffstat (limited to 'doc/_extensions/odoo_ext/translator.py')
| -rw-r--r-- | doc/_extensions/odoo_ext/translator.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/doc/_extensions/odoo_ext/translator.py b/doc/_extensions/odoo_ext/translator.py index 491f02a2ad3..211159e219c 100644 --- a/doc/_extensions/odoo_ext/translator.py +++ b/doc/_extensions/odoo_ext/translator.py @@ -13,8 +13,6 @@ from docutils import nodes from sphinx import addnodes, util from sphinx.locale import admonitionlabels -from odoo.tools import pycompat - def _parents(node): while node.parent: @@ -66,7 +64,7 @@ class BootstrapTranslator(nodes.NodeVisitor, object): self.param_separator = ',' def encode(self, text): - return pycompat.text_type(text).translate({ + return str(text).translate({ ord('&'): u'&', ord('<'): u'<', ord('"'): u'"', @@ -75,7 +73,7 @@ class BootstrapTranslator(nodes.NodeVisitor, object): }) def starttag(self, node, tagname, **attributes): - tagname = pycompat.text_type(tagname).lower() + tagname = str(tagname).lower() # extract generic attributes attrs = {name.lower(): value for name, value in attributes.items()} @@ -110,7 +108,7 @@ class BootstrapTranslator(nodes.NodeVisitor, object): # only "space characters" SPACE, CHARACTER TABULATION, LINE FEED, # FORM FEED and CARRIAGE RETURN should be collapsed, not al White_Space def attval(self, value, whitespace=re.compile(u'[ \t\n\f\r]+')): - return self.encode(whitespace.sub(u' ', pycompat.text_type(value))) + return self.encode(whitespace.sub(' ', str(value))) def astext(self): return u''.join(self.body) |
