Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2016-05-25 18:57:58 +0300
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2016-05-25 18:57:58 +0300
commit581a26168d711f709fe223c1249bee4fc98ed187 (patch)
treec10c6f4ab79a186f815fe371925acdfdea7a904d
parent5087228977caf5f750cb4d3af2097e68aa1c4bb5 (diff)
parent94f2dc2843db9efbdbcfcef44f49cbd1bd7098cd (diff)
Merge pull request #2556 from mitya57/xapian-python3
Make Xapian search work with Python 3
-rw-r--r--sphinx/websupport/search/xapiansearch.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/sphinx/websupport/search/xapiansearch.py b/sphinx/websupport/search/xapiansearch.py
index ee9b33da7..1e43dcbe9 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)))