[PATCH 1 of 9 3.26] [py3] Use six.text_type instead of unicode in wdoc views

Denis Laxalde denis.laxalde at logilab.fr
Thu Jun 28 12:28:28 CEST 2018


# HG changeset patch
# User Denis Laxalde <denis.laxalde at logilab.fr>
# Date 1530171518 -7200
#      Thu Jun 28 09:38:38 2018 +0200
# Branch 3.26
# Node ID d0bf06146782c9a69ea2c7c4952f0e22c64d1abb
# Parent  034bca253b551751779c97acde57caa37e1e6ed2
# Available At https://hg.logilab.org/review/cubicweb
#              hg pull https://hg.logilab.org/review/cubicweb -r d0bf06146782
# EXP-Topic py3
[py3] Use six.text_type instead of unicode in wdoc views

diff --git a/cubicweb/web/views/wdoc.py b/cubicweb/web/views/wdoc.py
--- a/cubicweb/web/views/wdoc.py
+++ b/cubicweb/web/views/wdoc.py
@@ -26,6 +26,8 @@ from os.path import join
 from bisect import bisect_right
 from datetime import date
 
+from six import text_type
+
 from logilab.common.changelog import ChangeLog
 from logilab.common.date import strptime, todate
 from logilab.common.registry import yes
@@ -98,9 +100,9 @@ def title_for_lang(node, lang):
     for title in node.findall('title'):
         title_lang = title.attrib['{http://www.w3.org/XML/1998/namespace}lang']
         if title_lang == lang:
-            return unicode(title.text)
+            return text_type(title.text)
         if title_lang == 'en':
-            fallback_title = unicode(title.text)
+            fallback_title = text_type(title.text)
     return fallback_title
 
 def subsections(node):


More information about the cubicweb-devel mailing list