Esempio n. 1
0
    def destroy(self):
        """
        从服务器上删除这个对象

        :rtype: None
        """
        if not self.id:
            return False
        client.delete('/classes/{0}/{1}'.format(self._class_name, self.id))
Esempio n. 2
0
    def destroy(self):
        """
        从服务器上删除这个对象

        :rtype: None
        """
        if not self.id:
            return
        client.delete("/classes/{0}/{1}".format(self._class_name, self.id),
                      self._flags)
Esempio n. 3
0
    def destroy_all(cls, objs):
        """
        在一个请求中 destroy 多个 leancloud.Object 对象实例。

        :param objs: 需要 destroy 的对象
        :type objs: list
        """
        if not objs:
            return
        if not all(x._class_name == objs[0]._class_name for x in objs):
            raise ValueError("destroy_all requires the argument object list's _class_names must be the same")
        if any(x.is_new() for x in objs):
            raise ValueError("Could not destroy unsaved object")
        ids = {x.id for x in objs}
        ids = ','.join(ids)
        client.delete('/classes/{0}/{1}'.format(objs[0]._class_name, ids))
Esempio n. 4
0
    def destroy_all(self):
        """
        在服务器上删除所有满足查询条件的对象。

        :raise: LeanCLoudError
        """
        result = client.delete('/classes/{0}'.format(self._query_class._class_name), self.dump())
        return result
Esempio n. 5
0
    def destroy_all(self):
        """
        在服务器上删除所有满足查询条件的对象。

        :raise: LeanCLoudError
        """
        result = client.delete(
            '/classes/{0}'.format(self._query_class._class_name), self.dump())
        return result
Esempio n. 6
0
    def unfollow(self, target_id):
        """
        取消关注一个用户。

        :param target_id: 需要关注的用户的 id
        :return:
        """
        if self.id is None:
            raise ValueError("Please sign in")
        response = client.delete("/users/{0}/friendship/{1}".format(self.id, target_id), None)
        assert response.ok
Esempio n. 7
0
    def unfollow(self, target_id):
        """
        取消关注一个用户。

        :param target_id: 需要关注的用户的 id
        :return:
        """
        if self.id is None:
            raise ValueError('Please sign in')
        response = client.delete('/users/{0}/friendship/{1}'.format(self.id, target_id), None)
        assert response.ok
Esempio n. 8
0
 def destroy(self):
     if not self.id:
         return False
     response = client.delete('/files/{0}'.format(self.id))
     if response.status_code != 200:
         raise LeanCloudError(1, "the file is not sucessfully destroyed")
Esempio n. 9
0
 def destroy(self):
     if not self.id:
         return False
     response = client.delete('/files/{0}'.format(self.id))
     if response.status_code != 200:
         raise LeanCloudError(1, "the file is not sucessfully destroyed")
Esempio n. 10
0
 def destroy(self):
     if not self.id:
         return False
     response = client.delete('/files/{0}'.format(self.id))
     content = utils.response_to_json(response)
     return response
Esempio n. 11
0
 def destroy(self):
     if not self.id:
         return False
     response = client.delete('/files/{}'.format(self.id))
     content = response.json()
     return response
Esempio n. 12
0
 def destroy(self):
     if not self.id:
         return False
     response = client.delete('/files/{0}'.format(self.id))
     content = utils.response_to_json(response)
     return response
Esempio n. 13
0
 def destroy(self):
     if not self.id:
         raise ValueError('This status is not saved')
     client.delete('/statuses/' + self.id)
Esempio n. 14
0
 def destroy(self):
     if not self.id:
         raise ValueError('This status is not saved')
     client.delete('/statuses/' + self.id)
Esempio n. 15
0
 def destroy(self):
     if not self.id:
         raise ValueError("This status is not saved")
     client.delete("/statuses/" + self.id)