def save(self, where=None, fetch_when_save=None):
        """
        将对象数据保存至服务器

        :return: None
        :rtype: None
        """
        if where and not isinstance(where, leancloud.Query):
            raise TypeError('where param type should be leancloud.Query, got %s', type(where))

        if where and where._query_class._class_name != self._class_name:
            raise TypeError('where param\'s class name not equal to the current object\'s class name')

        if where and self.is_new():
            raise TypeError('where params works only when leancloud.Object is saved')

        unsaved_children = []
        unsaved_files = []
        self._find_unsaved_children(self._attributes, unsaved_children, unsaved_files)
        if unsaved_children or unsaved_files:
            self._deep_save(unsaved_children, unsaved_files, exclude=self._attributes)

        data = self._dump_save()
        fetch_when_save = 'true' if fetch_when_save else 'false'

        if self.is_new():
            response = client.post('/classes/{0}?fetchWhenSave={1}'.format(self._class_name, fetch_when_save), data)
        else:
            url = '/classes/{0}/{1}?fetchWhenSave={2}'.format(self._class_name, self.id, fetch_when_save)
            if where:
                url += '&where=' + json.dumps(where.dump()['where'], separators=(',', ':'))
            response = client.put(url, data)

        self._update_data(response.json())
def save ( self , where = None , fetch_when_save = None ) : if where and not isinstance ( where , leancloud . Query ) : raise TypeError ( 'where param type should be leancloud.Query, got %s' , type ( where ) ) if where and where . _query_class . _class_name != self . _class_name : raise TypeError ( 'where param\'s class name not equal to the current object\'s class name' ) if where and self . is_new ( ) : raise TypeError ( 'where params works only when leancloud.Object is saved' ) unsaved_children = [ ] unsaved_files = [ ] self . _find_unsaved_children ( self . _attributes , unsaved_children , unsaved_files ) if unsaved_children or unsaved_files : self . _deep_save ( unsaved_children , unsaved_files , exclude = self . _attributes ) data = self . _dump_save ( ) fetch_when_save = 'true' if fetch_when_save else 'false' if self . is_new ( ) : response = client . post ( '/classes/{0}?fetchWhenSave={1}' . format ( self . _class_name , fetch_when_save ) , data ) else : url = '/classes/{0}/{1}?fetchWhenSave={2}' . format ( self . _class_name , self . id , fetch_when_save ) if where : url += '&where=' + json . dumps ( where . dump ( ) [ 'where' ] , separators = ( ',' , ':' ) ) response = client . put ( url , data ) self . _update_data ( response . json ( ) )
将对象数据保存至服务器

        :return: None
        :rtype: None