From 9bd4442784345d9a1f76588b5491346b705c17a5 Mon Sep 17 00:00:00 2001 From: Nikos Kouremenos Date: Wed, 6 Sep 2006 13:15:32 +0000 Subject: [PATCH] since we demand python 2.4 remove 2.3 legacy support code --- src/common/helpers.py | 8 -------- src/gtkgui_helpers.py | 9 ++++----- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/common/helpers.py b/src/common/helpers.py index 1aedc4c99..d48c740ca 100644 --- a/src/common/helpers.py +++ b/src/common/helpers.py @@ -463,14 +463,6 @@ def from_xs_boolean_to_python_boolean(value): return val -def ensure_unicode_string(s): - # py23 u'abc'.decode('utf-8') raises - # python24 does not. if python23 is ooold we can remove this func - # FIXME: remove this when we abandon py23 - if isinstance(s, str): - s = s.decode('utf-8') - return s - def get_xmpp_show(show): if show in ('online', 'offline'): return None diff --git a/src/gtkgui_helpers.py b/src/gtkgui_helpers.py index 30f46a0f6..fb6e3eaa8 100644 --- a/src/gtkgui_helpers.py +++ b/src/gtkgui_helpers.py @@ -126,8 +126,8 @@ def get_default_font(): # in try because daemon may not be there client = gconf.client_get_default() - return helpers.ensure_unicode_string( - client.get_string('/desktop/gnome/interface/font_name')) + return client.get_string('/desktop/gnome/interface/font_name' + ).decode('utf-8') except: pass @@ -147,8 +147,7 @@ def get_default_font(): for line in file(xfce_config_file): if line.find('name="Gtk/FontName"') != -1: start = line.find('value="') + 7 - return helpers.ensure_unicode_string( - line[start:line.find('"', start)]) + return line[start:line.find('"', start)].decode('utf-8') except: #we talk about file print >> sys.stderr, _('Error: cannot open %s for reading') % xfce_config_file @@ -163,7 +162,7 @@ def get_default_font(): font_name = values[0] font_size = values[1] font_string = '%s %s' % (font_name, font_size) # Verdana 9 - return helpers.ensure_unicode_string(font_string) + return font_string.decode('utf-8') except: #we talk about file print >> sys.stderr, _('Error: cannot open %s for reading') % kde_config_file