# HG changeset patch # User Goffi # Date 1652704678 -7200 # Node ID 580df5b557bef1cdf6d3a6d38abbc76eb2d03ea7 # Parent e2a1ac1afb38eb2b7821e88c2cf38306461e9a52 core (memory): `fileDelete` is now async, fix coroutine issue diff -r e2a1ac1afb38 -r 580df5b557be sat/memory/memory.py --- a/sat/memory/memory.py Mon May 16 14:20:01 2022 +0200 +++ b/sat/memory/memory.py Mon May 16 14:37:58 2022 +0200 @@ -1811,8 +1811,7 @@ raise exceptions.InternalError('Unexpected file type: {file_type}' .format(file_type=file_data['type'])) - @defer.inlineCallbacks - def fileDelete(self, client, peer_jid, file_id, recursive=False): + async def fileDelete(self, client, peer_jid, file_id, recursive=False): """Delete a single file or a directory and all its sub-files @param file_id(unicode): id of the file to delete @@ -1822,7 +1821,7 @@ """ # FIXME: we only allow owner of file to delete files for now, but WRITE access # should be checked too - files_data = yield self.getFiles(client, peer_jid, file_id) + files_data = await self.getFiles(client, peer_jid, file_id) if not files_data: raise exceptions.NotFound("Can't find the file with id {file_id}".format( file_id=file_id)) @@ -1830,7 +1829,7 @@ if file_data["type"] != C.FILE_TYPE_DIRECTORY and recursive: raise ValueError("recursive can only be set for directories") files_path = self.host.getLocalPath(None, C.FILES_DIR, profile=False) - yield self._deleteFile(client, peer_jid, recursive, files_path, file_data) + await self._deleteFile(client, peer_jid, recursive, files_path, file_data) ## Cache ##