You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
387 B
13 lines
387 B
from elasticsearch.serializer import JSONSerializer
|
|
|
|
from .utils import AttrList
|
|
|
|
class AttrJSONSerializer(JSONSerializer):
|
|
def default(self, data):
|
|
if isinstance(data, AttrList):
|
|
return data._l_
|
|
if hasattr(data, 'to_dict'):
|
|
return data.to_dict()
|
|
return super(AttrJSONSerializer, self).default(data)
|
|
|
|
serializer = AttrJSONSerializer()
|
|
|