From: Orakaro Date: Wed, 6 Aug 2014 14:12:11 +0000 (+0900) Subject: fix unicode bug in Python 3 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=612d6863fd6edb0bd9e88548721697ee4e8ddd91;p=rainbowstream.git fix unicode bug in Python 3 --- diff --git a/docs/conf.py b/docs/conf.py index aedd8b2..1ba586b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -48,9 +48,9 @@ copyright = u'2014, Vu Nhat Minh' # built documents. # # The short X.Y version. -version = '0.6.5' +version = '0.6.6' # The full version, including alpha/beta/rc tags. -release = '0.6.5' +release = '0.6.6' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/rainbowstream/py3patch.py b/rainbowstream/py3patch.py index adfbff2..616465e 100644 --- a/rainbowstream/py3patch.py +++ b/rainbowstream/py3patch.py @@ -23,6 +23,9 @@ unescape = HTMLParser().unescape # raw_input and map function behaviour if sys.version[0] == "2": lmap = lambda f, a: map(f, a) + unc = lambda x: x.decode('utf-8') else: raw_input = input lmap = lambda f, a: list(map(f, a)) + unc = lambda x: x + diff --git a/rainbowstream/rainbow.py b/rainbowstream/rainbow.py index 9546178..8760e78 100644 --- a/rainbowstream/rainbow.py +++ b/rainbowstream/rainbow.py @@ -445,7 +445,7 @@ def reply(): tid = c['tweet_dict'][id] user = t.statuses.show(id=tid)['user']['screen_name'] status = ' '.join(g['stuff'].split()[1:]) - status = '@' + user + ' ' + status.decode('utf-8') + status = '@' + user + ' ' + unc(status) t.statuses.update(status=status, in_reply_to_status_id=tid) @@ -744,7 +744,7 @@ def mute(): rel = t.mutes.users.create(screen_name=screen_name[1:]) if isinstance(rel, dict): printNicely(green(screen_name + ' is muted.')) - c['IGNORE_LIST'] += [screen_name.decode('utf8')] + c['IGNORE_LIST'] += [unc(screen_name)] c['IGNORE_LIST'] = list(set(c['IGNORE_LIST'])) else: printNicely(red(rel)) diff --git a/setup.py b/setup.py index c9bd0eb..642440e 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ import os import os.path # Bumped version -version = '0.6.5' +version = '0.6.6' # Require install_requires = [