comparison src/plugins/plugin_misc_upload.py @ 1851:ff603003d40a

plugin misc_upload: fixes things that have been forgotten after a refactoring
author souliane <souliane@mailoo.org>
date Tue, 23 Feb 2016 15:02:03 +0100
parents a19161bb3ff7
children 2daf7b4c6756
comparison
equal deleted inserted replaced
1850:6e547dd7f38c 1851:ff603003d40a
65 except KeyError: 65 except KeyError:
66 pass 66 pass
67 67
68 return self.fileUpload(client, filepath, filename or None, upload_jid, options or None) 68 return self.fileUpload(client, filepath, filename or None, upload_jid, options or None)
69 69
70 @defer.inlineCallbacks
71 def fileUpload(self, client, filepath, filename, upload_jid, options): 70 def fileUpload(self, client, filepath, filename, upload_jid, options):
72 """Send a file using best available method 71 """Send a file using best available method
73 72
74 parameters are the same as for [upload] 73 parameters are the same as for [upload]
75 @return (dict): action dictionary, with progress id in case of success, else xmlui message 74 @return (dict): action dictionary, with progress id in case of success, else xmlui message
81 def uploadEb(fail): 80 def uploadEb(fail):
82 msg = unicode(fail) 81 msg = unicode(fail)
83 log.warning(msg) 82 log.warning(msg)
84 return {'xmlui': xml_tools.note(u"Can't upload file", msg, C.XMLUI_DATA_LVL_WARNING).toXml()} 83 return {'xmlui': xml_tools.note(u"Can't upload file", msg, C.XMLUI_DATA_LVL_WARNING).toXml()}
85 84
86 d = self.upload(filepath, filename, upload_jid, options, client.profile) 85 d = self.upload(client, filepath, filename, upload_jid, options)
87 d.addCallback(uploadCb) 86 d.addCallback(uploadCb)
88 d.addErrback(uploadEb) 87 d.addErrback(uploadEb)
89 return d 88 return d
90 89
91 @defer.inlineCallbacks 90 @defer.inlineCallbacks