plugin upload: fixed inversion of title and message body + better error message on failed upload
This commit is contained in:
parent
1b312477b1
commit
985bc5efb7
1 changed files with 8 additions and 2 deletions
|
|
@ -26,6 +26,7 @@ from sat.core import exceptions
|
|||
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 @@ class UploadPlugin(object):
|
|||
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()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue