From 7be8efbab4ec3f4bd6911483ec51559056ee6563 Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Wed, 1 Dec 2010 19:29:29 +0100 Subject: [PATCH] fix unicode issues --- weboob/applications/qboobmsg/messages_manager.py | 5 +++-- weboob/applications/qhavesex/contacts.py | 12 ++++++------ weboob/applications/qhavesex/status.py | 3 ++- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/weboob/applications/qboobmsg/messages_manager.py b/weboob/applications/qboobmsg/messages_manager.py index c9d723546b..10688336c0 100644 --- a/weboob/applications/qboobmsg/messages_manager.py +++ b/weboob/applications/qboobmsg/messages_manager.py @@ -23,6 +23,7 @@ from weboob.capabilities.messages import ICapMessages, ICapMessagesPost, Message from weboob.tools.application.qt import QtDo +from weboob.tools.misc import to_unicode from .ui.messages_manager_ui import Ui_MessagesManager @@ -242,9 +243,9 @@ def _postReply_cb(self, backend, ignored): self.refreshThreadMessages(backend.name, self.thread.id) def _postReply_eb(self, backend, error, backtrace): - content = unicode(self.tr('Unable to send message:\n%s\n')) % error + content = unicode(self.tr('Unable to send message:\n%s\n')) % to_unicode(error) if logging.root.level == logging.DEBUG: - content += '\n%s\n' % backtrace + content += '\n%s\n' % to_unicode(backtrace) QMessageBox.critical(self, self.tr('Error while posting reply'), content, QMessageBox.Ok) self.ui.backendsList.setEnabled(True) diff --git a/weboob/applications/qhavesex/contacts.py b/weboob/applications/qhavesex/contacts.py index 3c1bd49598..fe24e0e624 100644 --- a/weboob/applications/qhavesex/contacts.py +++ b/weboob/applications/qhavesex/contacts.py @@ -23,6 +23,7 @@ from PyQt4.QtCore import SIGNAL, Qt from weboob.tools.application.qt import QtDo, HTMLDelegate +from weboob.tools.misc import to_unicode from weboob.capabilities.contact import ICapContact, Contact from weboob.capabilities.chat import ICapChat from weboob.capabilities.messages import ICapMessages, ICapMessagesPost, Message @@ -185,9 +186,9 @@ def _postReply_cb(self, backend, ignored): self.process_reply = None def _postReply_eb(self, backend, error, backtrace): - content = unicode(self.tr('Unable to send message:\n%s\n')) % error + content = unicode(self.tr('Unable to send message:\n%s\n')) % to_unicode(error) if logging.root.level == logging.DEBUG: - content += '\n%s\n' % backtrace + content += '\n%s\n' % to_unicode(backtrace) QMessageBox.critical(self, self.tr('Error while posting reply'), content, QMessageBox.Ok) self.process_reply = None @@ -214,9 +215,8 @@ def __init__(self, weboob, contact, parent=None): self.process_contact.do('fillobj', self.contact, missing_fields, backends=self.contact.backend) def gotError(self, backend, error, backtrace): - #self.process_contact.default_eb(backend, error, backtrace) self.ui.frame_photo.hide() - self.ui.descriptionEdit.setText('

Unable to show profile

%s

' % error) + self.ui.descriptionEdit.setText('

Unable to show profile

%s

' % to_unicode(error)) def gotProfile(self, backend, contact): if not backend: @@ -504,8 +504,8 @@ def urlClicked_cb(self, backend, contact): self.setContact(contact) def urlClicked_eb(self, backend, error, backtrace): - content = unicode(self.tr('Unable to get contact:\n%s\n')) % error + content = unicode(self.tr('Unable to get contact:\n%s\n')) % to_unicode(error) if logging.root.level == logging.DEBUG: - content += '\n%s\n' % backtrace + content += u'\n%s\n' % to_unicode(backtrace) QMessageBox.critical(self, self.tr('Error while getting contact'), content, QMessageBox.Ok) diff --git a/weboob/applications/qhavesex/status.py b/weboob/applications/qhavesex/status.py index f38c8e59ca..8ffa14b321 100644 --- a/weboob/applications/qhavesex/status.py +++ b/weboob/applications/qhavesex/status.py @@ -20,6 +20,7 @@ from weboob.capabilities.account import ICapAccount, StatusField from weboob.tools.application.qt import QtDo +from weboob.tools.misc import to_unicode class Account(QFrame): def __init__(self, weboob, backend, parent=None): @@ -97,7 +98,7 @@ def updateStats_cb(self, backend, field): self.process.body += u'%s: %s' % (field.label, field.value) def updateStats_eb(self, backend, err, backtrace): - self.body.setText(u'Unable to connect: %s' % unicode(err)) + self.body.setText(u'Unable to connect: %s' % to_unicode(err)) self.title.setText(u'%s' % unicode(self.title.text())) class AccountsStatus(QScrollArea): -- GitLab