[Python-modules-commits] [sphinx] 01/02: Make Xapian search work with Python 3

Dmitry Shachnev mitya57 at moszumanska.debian.org
Thu May 26 10:46:56 UTC 2016


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

mitya57 pushed a commit to branch master
in repository sphinx.

commit 9d0069c48dd14cb5a911cb3a42cea0f4bce98215
Author: Dmitry Shachnev <mitya57 at gmail.com>
Date:   Wed May 18 11:48:36 2016 +0300

    Make Xapian search work with Python 3
    
    Origin: upstream, https://github.com/sphinx-doc/sphinx/commit/94f2dc2843db9efb
---
 sphinx/websupport/search/xapiansearch.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/sphinx/websupport/search/xapiansearch.py b/sphinx/websupport/search/xapiansearch.py
index ee9b33d..1e43dcb 100644
--- a/sphinx/websupport/search/xapiansearch.py
+++ b/sphinx/websupport/search/xapiansearch.py
@@ -11,6 +11,8 @@
 
 import xapian
 
+from six import string_types
+
 from sphinx.util.osutil import ensuredir
 from sphinx.websupport.search import BaseSearch
 
@@ -73,7 +75,10 @@ class XapianSearch(BaseSearch):
         results = []
 
         for m in matches:
-            context = self.extract_context(m.document.get_data())
+            data = m.document.get_data()
+            if not isinstance(data, string_types):
+                data = data.decode("utf-8")
+            context = self.extract_context(data)
             results.append((m.document.get_value(self.DOC_PATH),
                             m.document.get_value(self.DOC_TITLE),
                             ''.join(context)))

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



More information about the Python-modules-commits mailing list