@asaka
比如这个云函数
@engine.define
def getHotArticle(**param):
query = Query('Article')
query.add_descending('favourCount')
query.add_descending('commentCount')
query.add_descending('createdAt')
query.limit(1000)
article_list = query.find()
return article_list
移动端(或者在线API工具)调用时直接报脚本错误:
ERROR web1 11:01:10 Traceback (most recent call last):
ERROR web1 11:01:10 chunks = self.iterencode(o, _one_shot=True)
ERROR web1 11:01:10 File "/usr/lib/python2.7/json/encoder.py", line 270, in iterencode
ERROR web1 11:01:10 return _iterencode(o, 0)
ERROR web1 11:01:10 File "/usr/lib/python2.7/json/encoder.py", line 184, in default
ERROR web1 11:01:10 raise TypeError(repr(o) + " is not JSON serializable")
ERROR web1 11:01:10 TypeError: <avobject_class_define.Article object at 0x7fd715e19690> is not JSON serializable