# HG changeset patch # User Denis Laxalde # Date 1530173186 -7200 # Node ID 4c0f7ef3145cf7b99a5632cf8a54925c1ac023c9 # Parent 1693730548ef0416fdef666abbf6c5348ade089f [py3] Open rst file in text mode in wdoc view Otherwise, UStringIO complains that it receives bytes. diff -r 1693730548ef -r 4c0f7ef3145c cubicweb/web/views/wdoc.py --- a/cubicweb/web/views/wdoc.py Thu Jun 28 11:11:10 2018 +0200 +++ b/cubicweb/web/views/wdoc.py Thu Jun 28 10:06:26 2018 +0200 @@ -21,6 +21,7 @@ """ +import io from itertools import chain from os.path import join from xml.etree.ElementTree import parse @@ -132,8 +133,8 @@ self.navigation_links(node) self.w(u'
') self.w(u'

%s

' % (title_for_lang(node, self._cw.lang))) - data = open(join(resourcedir, rid)).read() - self.w(rest_publish(self, data)) + with io.open(join(resourcedir, rid)) as f: + self.w(rest_publish(self, f.read())) if node is not None: self.subsections_links(node) self.w(u'
') @@ -200,7 +201,8 @@ break else: raise NotFound - self.w(open(join(resourcedir, rid)).read()) + with io.open(join(resourcedir, rid)) as f: + self.w(f.read()) class HelpAction(action.Action):