the sphinx.search.js_index is now able to load and dump data from binary streams

This commit is contained in:
Daniel Neuhäuser 2010-06-17 05:56:06 +02:00
parent b1f29495ab
commit 38d11bbe14

View File

@ -58,10 +58,13 @@ class _JavaScriptIndex(object):
return jsdump.loads(data)
def dump(self, data, f):
f.write(self.dumps(data))
f.write(self.dumps(data).encode('utf-8'))
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()