comparison 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
comparison
equal deleted inserted replaced
3357:40794e658d68 3358:b14e95f7034f
1466 None to ignore 1466 None to ignore
1467 empty string to look for current version 1467 empty string to look for current version
1468 @param parent(unicode, None): id of the directory containing the files 1468 @param parent(unicode, None): id of the directory containing the files
1469 None to ignore 1469 None to ignore
1470 empty string to look for root files/directories 1470 empty string to look for root files/directories
1471 @param path(unicode, None): path to the directory containing the files 1471 @param path(Path, unicode, None): path to the directory containing the files
1472 @param type_(unicode, None): type of file filter, can be one of C.FILE_TYPE_* 1472 @param type_(unicode, None): type of file filter, can be one of C.FILE_TYPE_*
1473 @param file_hash(unicode, None): hash of the file to retrieve 1473 @param file_hash(unicode, None): hash of the file to retrieve
1474 @param hash_algo(unicode, None): algorithm use for file_hash 1474 @param hash_algo(unicode, None): algorithm use for file_hash
1475 @param name(unicode, None): name of the file to retrieve 1475 @param name(unicode, None): name of the file to retrieve
1476 @param namespace(unicode, None): namespace of the files to retrieve 1476 @param namespace(unicode, None): namespace of the files to retrieve
1497 "perms_to_check must be None" 1497 "perms_to_check must be None"
1498 ) 1498 )
1499 if owner is not None: 1499 if owner is not None:
1500 owner = owner.userhostJID() 1500 owner = owner.userhostJID()
1501 if path is not None: 1501 if path is not None:
1502 path = str(path)
1502 # permission are checked by _getParentDir 1503 # permission are checked by _getParentDir
1503 parent, remaining_path_elts = yield self._getParentDir( 1504 parent, remaining_path_elts = yield self._getParentDir(
1504 client, path, parent, namespace, owner, peer_jid, perms_to_check 1505 client, path, parent, namespace, owner, peer_jid, perms_to_check
1505 ) 1506 )
1506 if remaining_path_elts: 1507 if remaining_path_elts:
1628 ) 1629 )
1629 if owner is not None: 1630 if owner is not None:
1630 owner = owner.userhostJID() 1631 owner = owner.userhostJID()
1631 1632
1632 if path is not None: 1633 if path is not None:
1634 path = str(path)
1633 # _getParentDir will check permissions if peer_jid is set, so we use owner 1635 # _getParentDir will check permissions if peer_jid is set, so we use owner
1634 parent, remaining_path_elts = yield self._getParentDir( 1636 parent, remaining_path_elts = yield self._getParentDir(
1635 client, path, parent, namespace, owner, owner, perms_to_check 1637 client, path, parent, namespace, owner, owner, perms_to_check
1636 ) 1638 )
1637 # if remaining directories don't exist, we have to create them 1639 # if remaining directories don't exist, we have to create them