Mercurial > libervia-backend
changeset 2863:a97a5c73594d
plugin upload: fixed inversion of title and message body + better error message on failed upload
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 20 Mar 2019 09:08:47 +0100 |
parents | b2e898384c25 |
children | 33a69ee7fbb7 |
files | sat/plugins/plugin_misc_upload.py |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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() }