# HG changeset patch # User Goffi # Date 1410184251 -7200 # Node ID 69aace10b46d8c02d55940323eb16feb03628338 # Parent 9a85836f0d4534875872867e20d1dd9e1ba5d3e4 Primitivus (file transfer): an error popup is shown when bad unicode is used in path, and an info popup is show to indicate that the file request has been sent diff -r 9a85836f0d45 -r 69aace10b46d frontends/src/primitivus/chat.py --- a/frontends/src/primitivus/chat.py Mon Sep 08 15:50:51 2014 +0200 +++ b/frontends/src/primitivus/chat.py Mon Sep 08 15:50:51 2014 +0200 @@ -18,6 +18,8 @@ # along with this program. If not, see . from sat.core.i18n import _ +from sat.core import log as logging +log = logging.getLogger(__name__) import urwid from urwid_satext import sat_widgets from urwid_satext.files_management import FileDialog @@ -385,6 +387,12 @@ #MISC EVENTS# def onFileSelected(self, filepath): self.host.removePopUp() + try: + filepath = filepath.decode('utf-8') # FIXME: correctly manage unicode + except UnicodeError: + log.error("FIXME: filepath with unicode error are not managed yet") + self.host.showDialog(_(u"File has a unicode error in its name, it's not yet managed by SàT"), title=_("Can't send file"), type_="error") + return #FIXME: check last_resource: what if self.target.resource exists ? last_resource = self.host.bridge.getLastResource(unicode(self.target.bare), self.host.profile) if last_resource: @@ -393,3 +401,4 @@ full_jid = self.target progress_id = self.host.bridge.sendFile(full_jid, filepath, {}, self.host.profile) self.host.addProgress(progress_id,filepath) + self.host.showDialog(_(u"You file request has been sent, we are waiting for your contact answer"), title=_("File request sent"))