mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
the sphinx.search.js_index is now able to load and dump data from binary streams
This commit is contained in:
parent
b1f29495ab
commit
38d11bbe14
@ -58,10 +58,13 @@ class _JavaScriptIndex(object):
|
|||||||
return jsdump.loads(data)
|
return jsdump.loads(data)
|
||||||
|
|
||||||
def dump(self, data, f):
|
def dump(self, data, f):
|
||||||
f.write(self.dumps(data))
|
f.write(self.dumps(data).encode('utf-8'))
|
||||||
|
|
||||||
def load(self, f):
|
def load(self, f):
|
||||||
return self.loads(f.read())
|
data = f.read()
|
||||||
|
if isinstance(data, unicode):
|
||||||
|
return self.loads(data)
|
||||||
|
return self.loads(data.decode('utf-8'))
|
||||||
|
|
||||||
|
|
||||||
js_index = _JavaScriptIndex()
|
js_index = _JavaScriptIndex()
|
||||||
|
Loading…
Reference in New Issue
Block a user