summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-06-16 09:47:52 +0000
committerlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-06-16 09:47:52 +0000
commitffaf7af1e68f9195b08dd39e1756442fdecbafc1 (patch)
tree3adc48852b3786b143da5e6cc429c24c586b9cc1
parent3c1b35a371ed60349b504df460bb59023cd3b95c (diff)
downloadpoezio-ffaf7af1e68f9195b08dd39e1756442fdecbafc1.tar.gz
poezio-ffaf7af1e68f9195b08dd39e1756442fdecbafc1.tar.bz2
poezio-ffaf7af1e68f9195b08dd39e1756442fdecbafc1.tar.xz
poezio-ffaf7af1e68f9195b08dd39e1756442fdecbafc1.zip
fix role=none crash. Fixed #1492
-rw-r--r--src/gui.py2
-rw-r--r--src/window.py12
2 files changed, 11 insertions, 3 deletions
diff --git a/src/gui.py b/src/gui.py
index 988142f6..bbe658fc 100644
--- a/src/gui.py
+++ b/src/gui.py
@@ -422,7 +422,7 @@ class Gui(object):
if by:
self.add_message_to_room(room, _("You have been kicked by %(by)s. Reason: %(reason)s") % {'by':by, 'reason':reason})
else:
- self.add_message_to_room(room, _("You have been kicked. Reason: %s") % (reason))
+ self.add_message_to_room(room, _("You have been kicked. Reason: %s") % (reason.encode('utf-8')))
else:
if by:
self.add_message_to_room(room, _("%(nick)s has been kicked by %(by)s. Reason: %(reason)s") % {'nick':from_nick, 'by':by, 'reason':reason})
diff --git a/src/window.py b/src/window.py
index 19fcc63b..7e2686be 100644
--- a/src/window.py
+++ b/src/window.py
@@ -70,11 +70,19 @@ class UserList(Win):
def refresh(self, users):
def compare_user(a, b):
- if self.color_role[a.role] == self.color_role[b.role]:
+ try:
+ arole = self.color_role[a.role]
+ except KeyError:
+ arole = 1
+ try:
+ brole = self.color_role[b.role]
+ except KeyError:
+ brole = 1
+ if arole == brole:
if a.nick.lower() < b.nick.lower():
return -1
return 1
- return self.color_role[a.role] - self.color_role[b.role]
+ return arole - brole
if not self.visible:
return
self.win.erase()