Mercurial > libervia-backend
comparison sat/plugins/plugin_misc_upload.py @ 2867:3cac3d050046
plugin upload: minor fixes in some docstring length
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 22 Mar 2019 19:26:09 +0100 |
parents | a97a5c73594d |
children | ab2696e34d29 |
comparison
equal
deleted
inserted
replaced
2866:8ce5748bfe97 | 2867:3cac3d050046 |
---|---|
82 | 82 |
83 def fileUpload(self, client, filepath, filename, upload_jid, options): | 83 def fileUpload(self, client, filepath, filename, upload_jid, options): |
84 """Send a file using best available method | 84 """Send a file using best available method |
85 | 85 |
86 parameters are the same as for [upload] | 86 parameters are the same as for [upload] |
87 @return (dict): action dictionary, with progress id in case of success, else xmlui message | 87 @return (dict): action dictionary, with progress id in case of success, else xmlui |
88 message | |
88 """ | 89 """ |
89 | 90 |
90 def uploadCb(data): | 91 def uploadCb(data): |
91 progress_id, __ = data | 92 progress_id, __ = data |
92 return {"progress": progress_id} | 93 return {"progress": progress_id} |
121 or None to use autodetected, if possible | 122 or None to use autodetected, if possible |
122 @param options(dict): option to use for the upload, may be: | 123 @param options(dict): option to use for the upload, may be: |
123 - ignore_tls_errors(bool): True to ignore SSL/TLS certificate verification | 124 - ignore_tls_errors(bool): True to ignore SSL/TLS certificate verification |
124 used only if HTTPS transport is needed | 125 used only if HTTPS transport is needed |
125 @param profile: %(doc_profile)s | 126 @param profile: %(doc_profile)s |
126 @return (tuple[unicode,D(unicode)]): progress_id and a Deferred which fire download URL | 127 @return (tuple[unicode,D(unicode)]): progress_id and a Deferred which fire |
127 when upload is finished | 128 download URL when upload is finished |
128 """ | 129 """ |
129 if options is None: | 130 if options is None: |
130 options = {} | 131 options = {} |
131 if not os.path.isfile(filepath): | 132 if not os.path.isfile(filepath): |
132 raise exceptions.DataError(u"The given path doesn't link to a file") | 133 raise exceptions.DataError(u"The given path doesn't link to a file") |
151 """Register a fileUploading method | 152 """Register a fileUploading method |
152 | 153 |
153 @param method_name(unicode): short name for the method, must be unique | 154 @param method_name(unicode): short name for the method, must be unique |
154 @param available_cb(callable): method to call to check if this method is usable | 155 @param available_cb(callable): method to call to check if this method is usable |
155 the callback must take two arguments: upload_jid (can be None) and profile | 156 the callback must take two arguments: upload_jid (can be None) and profile |
156 the callback must return the first entity found (being upload_jid or one of its components) | 157 the callback must return the first entity found (being upload_jid or one of its |
158 components) | |
157 exceptions.NotFound must be raised if no entity has been found | 159 exceptions.NotFound must be raised if no entity has been found |
158 @param upload_cb(callable): method to upload a file | 160 @param upload_cb(callable): method to upload a file |
159 must have the same signature as [fileUpload] | 161 must have the same signature as [fileUpload] |
160 must return a tuple with progress_id and a Deferred which fire download URL when | 162 must return a tuple with progress_id and a Deferred which fire download URL |
161 upload is finished | 163 when upload is finished |
162 @param priority(int): pririoty of this method, the higher available will be used | 164 @param priority(int): pririoty of this method, the higher available will be used |
163 """ | 165 """ |
164 assert method_name | 166 assert method_name |
165 for data in self._upload_callbacks: | 167 for data in self._upload_callbacks: |
166 if method_name == data[0]: | 168 if method_name == data[0]: |