core (memory), plugin XEP-0329, plugin invitation: minor style improvments

This commit is contained in:
Goffi 2019-04-14 08:21:51 +02:00
commit 5e2426c065

View file

@ -1417,27 +1417,11 @@ class Memory(object):
@defer.inlineCallbacks
def setFile(
self,
client,
name,
file_id=None,
version=u"",
parent=None,
path=None,
type_=C.FILE_TYPE_FILE,
file_hash=None,
hash_algo=None,
size=None,
namespace=None,
mime_type=None,
created=None,
modified=None,
owner=None,
access=None,
extra=None,
peer_jid=None,
perms_to_check=(C.ACCESS_PERM_WRITE,),
):
self, client, name, file_id=None, version=u"", parent=None, path=None,
type_=C.FILE_TYPE_FILE, file_hash=None, hash_algo=None, size=None,
namespace=None, mime_type=None, created=None, modified=None, owner=None,
access=None, extra=None, peer_jid=None, perms_to_check=(C.ACCESS_PERM_WRITE,)
):
"""set a file metadata
@param name(unicode): basename of the file
@ -1446,32 +1430,38 @@ class Memory(object):
empty string for current version or when there is no versioning
@param parent(unicode, None): id of the directory containing the files
@param path(unicode, None): virtual path of the file in the namespace
if set, parent must be None. All intermediate directories will be created if needed,
using current access.
if set, parent must be None. All intermediate directories will be created
if needed, using current access.
@param file_hash(unicode): unique hash of the payload
@param hash_algo(unicode): algorithm used for hashing the file (usually sha-256)
@param size(int): size in bytes
@param namespace(unicode, None): identifier (human readable is better) to group files
for instance, namespace could be used to group files in a specific photo album
@param namespace(unicode, None): identifier (human readable is better) to group
files
For instance, namespace could be used to group files in a specific photo album
@param mime_type(unicode): MIME type of the file, or None if not known/guessed
@param created(int): UNIX time of creation
@param modified(int,None): UNIX time of last modification, or None to use created date
@param owner(jid.JID, None): jid of the owner of the file (mainly useful for component)
@param modified(int,None): UNIX time of last modification, or None to use
created date
@param owner(jid.JID, None): jid of the owner of the file (mainly useful for
component)
will be used to check permission (only bare jid is used, don't use with MUC).
Use None to ignore permission (perms_to_check must be None too)
@param access(dict, None): serialisable dictionary with access rules.
None (or empty dict) to use private access, i.e. allow only profile's jid to access the file
None (or empty dict) to use private access, i.e. allow only profile's jid to
access the file
key can be on on C.ACCESS_PERM_*,
then a sub dictionary with a type key is used (one of C.ACCESS_TYPE_*).
According to type, extra keys can be used:
- C.ACCESS_TYPE_PUBLIC: the permission is granted for everybody
- C.ACCESS_TYPE_WHITELIST: the permission is granted for jids (as unicode) in the 'jids' key
- C.ACCESS_TYPE_WHITELIST: the permission is granted for jids (as unicode)
in the 'jids' key
will be encoded to json in database
@param extra(dict, None): serialisable dictionary of any extra data
will be encoded to json in database
@param perms_to_check(tuple[unicode],None): permission to check
must be a tuple of C.ACCESS_PERM_* or None
if None, permission will no be checked (peer_jid must be None too in this case)
if None, permission will no be checked (peer_jid must be None too in this
case)
@param profile(unicode): profile owning the file
"""
if "/" in name: