query = Query(CliqueVote)
print dir(query)

结果如下:

['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_add_condition', '_and_query', '_extra', '_include', '_limit', '_new_object', '_or_query', '_order', '_process_result', '_query_class', '_quote', '_select', '_skip', '_where', 'add_ascending', 'add_descending', 'and_', 'ascending', 'contained_in', 'contains', 'contains_all', 'count', 'descending', 'do_cloud_query', 'does_not_exists', 'does_not_match_key_in_query', 'does_not_match_query', 'dump', 'endswith', 'equal_to', 'exists', 'find', 'first', 'get', 'greater_than', 'greater_than_or_equal_to', 'include', 'less_than', 'less_than_or_equal_to', 'limit', 'matched', 'matched_key_in_query', 'matches_key_in_query', 'matches_query', 'near', 'not_contained_in', 'not_equal_to', 'or_', 'select', 'skip', 'startswith', 'within_geo_box', 'within_kilometers', 'within_miles', 'within_radians']

其中并不包含文档中提及的destroy_all1方法。直接调用query.destroy_all()也会报错。

Traceback (most recent call last):
  File "/home/xmrg/share/provemewrongServer/env/local/lib/python2.7/site-packages/leancloud/engine/leanengine.py", line 106, in dispatch_request
    result = dispatch_cloud_hook(**values)
  File "/home/xmrg/share/provemewrongServer/env/local/lib/python2.7/site-packages/leancloud/engine/leanengine.py", line 212, in dispatch_cloud_hook
    func(obj)
  File "/home/xmrg/share/provemewrongServer/cloud.py", line 32, in before_clique_vote_save
    query.destroy_all() 
AttributeError: 'Query' object has no attribute 'destroy_all'

请问这是BUG吗

查看了一下源码,发现destroy_all方法也是注释掉的:


请问你们这样做原因何在呢?

不好意思,api 文档没有更新,实际上这个方法是不可用的。可以尝试 leancloud.Object.destroy_all(list_of_objs) 来删除多个对象,不过需要提前查询出所有要删除的对象。

然后文档又没有说leancloud.Object.destroy_all(list_of_objs) 方法。。。为什么js有query.destroy_all方法而python没有呢。文档更新一般延迟多久啊。。。

不好意思,尽快解决这个问题,以后文档随 SDK 更新自动发布。

好的,谢谢^_^