diff sat/memory/memory.py @ 3358:b14e95f7034f

core (memory/memory): use `str` for `path` in `getFiles` and `setFile` to allow use of `Path` instances
author Goffi <goffi@goffi.org>
date Thu, 17 Sep 2020 16:34:22 +0200
parents 2a7e36b69fd2
children 43e60c40de65
line wrap: on
line diff
--- a/sat/memory/memory.py	Thu Sep 17 11:27:57 2020 +0200
+++ b/sat/memory/memory.py	Thu Sep 17 16:34:22 2020 +0200
@@ -1468,7 +1468,7 @@
         @param parent(unicode, None): id of the directory containing the files
             None to ignore
             empty string to look for root files/directories
-        @param path(unicode, None): path to the directory containing the files
+        @param path(Path, unicode, None): path to the directory containing the files
         @param type_(unicode, None): type of file filter, can be one of C.FILE_TYPE_*
         @param file_hash(unicode, None): hash of the file to retrieve
         @param hash_algo(unicode, None): algorithm use for file_hash
@@ -1499,6 +1499,7 @@
         if owner is not None:
             owner = owner.userhostJID()
         if path is not None:
+            path = str(path)
             # permission are checked by _getParentDir
             parent, remaining_path_elts = yield self._getParentDir(
                 client, path, parent, namespace, owner, peer_jid, perms_to_check
@@ -1630,6 +1631,7 @@
             owner = owner.userhostJID()
 
         if path is not None:
+            path = str(path)
             # _getParentDir will check permissions if peer_jid is set, so we use owner
             parent, remaining_path_elts = yield self._getParentDir(
                 client, path, parent, namespace, owner, owner, perms_to_check