Mercurial > libervia-backend
comparison src/plugins/plugin_misc_file.py @ 2148:a543eda2c923
core (memory/disco): getInfos now handle node + use client instead of profile in many methods
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 12 Feb 2017 20:43:20 +0100 |
parents | 33c8c4973743 |
children | 8b37a62336c3 |
comparison
equal
deleted
inserted
replaced
2147:bca699faf416 | 2148:a543eda2c923 |
---|---|
209 @param filename(unicode, None): name to use, or None to find it from filepath | 209 @param filename(unicode, None): name to use, or None to find it from filepath |
210 @param file_desc(unicode, None): description of the file | 210 @param file_desc(unicode, None): description of the file |
211 @param profile: %(doc_profile)s | 211 @param profile: %(doc_profile)s |
212 @return (dict): action dictionary, with progress id in case of success, else xmlui message | 212 @return (dict): action dictionary, with progress id in case of success, else xmlui message |
213 """ | 213 """ |
214 client = self.host.getClient(profile) | |
214 if not os.path.isfile(filepath): | 215 if not os.path.isfile(filepath): |
215 raise exceptions.DataError(u"The given path doesn't link to a file") | 216 raise exceptions.DataError(u"The given path doesn't link to a file") |
216 if not filename: | 217 if not filename: |
217 filename = os.path.basename(filepath) or '_' | 218 filename = os.path.basename(filepath) or '_' |
218 for namespace, callback, priority, method_name in self._file_callbacks: | 219 for namespace, callback, priority, method_name in self._file_callbacks: |
219 has_feature = yield self.host.hasFeature(namespace, peer_jid, profile) | 220 has_feature = yield self.host.hasFeature(client, namespace, peer_jid) |
220 if has_feature: | 221 if has_feature: |
221 log.info(u"{name} method will be used to send the file".format(name=method_name)) | 222 log.info(u"{name} method will be used to send the file".format(name=method_name)) |
222 progress_id = yield callback(peer_jid, filepath, filename, file_desc, profile) | 223 progress_id = yield callback(peer_jid, filepath, filename, file_desc, profile) |
223 defer.returnValue({'progress': progress_id}) | 224 defer.returnValue({'progress': progress_id}) |
224 msg = u"Can't find any method to send file to {jid}".format(jid=peer_jid.full()) | 225 msg = u"Can't find any method to send file to {jid}".format(jid=peer_jid.full()) |