From f5e925048580f00b9dda01f43350b845d745f97a Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Wed, 30 May 2018 14:55:32 +0200 Subject: [PATCH] [FIX] _extensions: p3 compatibility (8) --- _extensions/odoo/translator.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/_extensions/odoo/translator.py b/_extensions/odoo/translator.py index 34739d870..de7901c2f 100644 --- a/_extensions/odoo/translator.py +++ b/_extensions/odoo/translator.py @@ -10,6 +10,12 @@ from sphinx.locale import admonitionlabels from . import pycompat +try: + from urllib import url2pathname +except ImportError: + # P3 + from urllib.request import url2pathname + def _parents(node): while node.parent: @@ -652,7 +658,7 @@ class BootstrapTranslator(nodes.NodeVisitor, object): banner = '_static/' + cover base, ext = os.path.splitext(banner) small = "{}.small{}".format(base, ext) - if os.path.isfile(urllib.url2pathname(small)): + if os.path.isfile(url2pathname(small)): banner = small style = u"background-image: url('{}')".format( util.relative_uri(baseuri, banner) or '#')