# HG changeset patch # User Goffi # Date 1553069327 -3600 # Node ID a97a5c73594d3005b93ee2b5c121cdb413538a7a # Parent b2e898384c25ab1ab129b500e7ef80ea3a7b0c2d plugin upload: fixed inversion of title and message body + better error message on failed upload diff -r b2e898384c25 -r a97a5c73594d sat/plugins/plugin_misc_upload.py --- a/sat/plugins/plugin_misc_upload.py Wed Mar 20 09:08:47 2019 +0100 +++ b/sat/plugins/plugin_misc_upload.py Wed Mar 20 09:08:47 2019 +0100 @@ -26,6 +26,7 @@ from sat.tools import xml_tools from twisted.internet import defer from twisted.words.protocols.jabber import jid +from twisted.words.protocols.jabber import error as jabber_error import os import os.path @@ -91,11 +92,16 @@ return {"progress": progress_id} def uploadEb(fail): - msg = unicode(fail) + if (isinstance(fail.value, jabber_error.StanzaError) + and fail.value.condition == 'not-acceptable'): + reason = fail.value.text + else: + reason = unicode(fail.value) + msg = D_(u"Can't upload file: {reason}").format(reason=reason) log.warning(msg) return { "xmlui": xml_tools.note( - u"Can't upload file", msg, C.XMLUI_DATA_LVL_WARNING + msg, D_(u"Can't upload file"), C.XMLUI_DATA_LVL_WARNING ).toXml() }