[Python-modules-commits] [drf-extensions] 03/05: Make backdoc compatible with Python3.

Michael Fladischer fladi at moszumanska.debian.org
Wed Mar 1 14:22:37 UTC 2017


This is an automated email from the git hooks/post-receive script.

fladi pushed a commit to branch master
in repository drf-extensions.

commit ae1436b7c70d132c5a6e02520235a0697ee4f588
Author: Michael Fladischer <FladischerMichael at fladi.at>
Date:   Wed Mar 1 13:09:42 2017 +0100

    Make backdoc compatible with Python3.
---
 docs/backdoc.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/docs/backdoc.py b/docs/backdoc.py
index 2875eea..51fb75c 100644
--- a/docs/backdoc.py
+++ b/docs/backdoc.py
@@ -2265,7 +2265,7 @@ def main(argv=None):
 
     if opts.link_patterns_file:
         link_patterns = []
-        f = open(opts.link_patterns_file)
+        f = codecs.open(opts.link_patterns_file, 'r', opts.encoding)
         try:
             for i, line in enumerate(f.readlines()):
                 if not line.strip(): continue
@@ -2670,7 +2670,7 @@ class BackDoc(object):
 
     def run(self, argv):
         kwargs = self.get_kwargs(argv)
-        self.stdout.write(self.get_result_html(**kwargs).encode('utf-8'))
+        self.stdout.write(self.get_result_html(**kwargs))
 
     def get_kwargs(self, argv):
         parsed = dict(self.parser.parse_args(argv)._get_kwargs())
@@ -2680,7 +2680,7 @@ class BackDoc(object):
         kwargs = {}
         kwargs['title'] = force_text(parsed.get('title') or 'Documentation')
         if parsed.get('source'):
-            kwargs['markdown_src'] = open(parsed['source'], 'r').read()
+            kwargs['markdown_src'] = codecs.open(parsed['source'], 'r', 'utf-8').read()
         else:
             kwargs['markdown_src'] = self.stdin.read()
         kwargs['markdown_src'] = force_text(kwargs['markdown_src'] or '')

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/drf-extensions.git



More information about the Python-modules-commits mailing list