1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-29 15:42:04 +03:00

pylibsmb: Move deltree to python code

This is much shorter. There's also another aspect: I'm working on
improving cli_list() to not collect all files before starting to call
the callback function. This means that the cli_list cb will be called
from within tevent_loop_once(). In pylibsmb.c's deltree code this
would create a nested event loop. By moving the deltree code into the
python world this nested event loop is avoided. Now the python code
will first collect everything and then start to delete, avoiding the
nesting. A future development should make listing directories a
generator or something like that.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Volker Lendecke
2020-11-06 22:08:00 +01:00
committed by Jeremy Allison
parent 2cff5990da
commit 13aecb22f7
2 changed files with 7 additions and 95 deletions

View File

@ -16,4 +16,10 @@
from samba.samba3.libsmb_samba_cwrapper import *
class Conn(LibsmbCConn):
pass
def deltree(self, path):
if self.chkpath(path):
for entry in self.list(path):
self.deltree(path + "\\" + entry['name'])
self.rmdir(path)
else:
self.unlink(path)