Skip to content

Commit

Permalink
Merge pull request sopel-irc#637 from oklahomer/hotfix/rss_default_co…
Browse files Browse the repository at this point in the history
…lour

[rss] Fix default value for fg/bg. Fix sopel-irc#636
  • Loading branch information
embolalia committed Oct 27, 2014
2 parents 823a869 + f92dde2 commit 16ee5af
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions rss.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ def migrate_from_old_tables(bot, c):
'''.format(sub), (channel, site_name, site_url, fg, bg))


def colour_text(text, fg, bg=''):
def colour_text(text, fg=None, bg=None):
"""Given some text and fore/back colours, return a coloured text string."""
if fg == '':
if fg is None:
return text
else:
colour = '{0},{1}'.format(fg, bg) if bg != '' else fg
colour = '{0},{1}'.format(fg, bg) if bg is not None else fg
return "\x03{0}{1}\x03".format(colour, text)


Expand Down Expand Up @@ -198,8 +198,8 @@ def _rss_add(self, bot, trigger, c):
channel = match.group(1)
feed_name = match.group(2).strip('"')
feed_url = match.group(3)
fg = int(match.group(4)) % 16 if match.group(4) else ''
bg = int(match.group(5)) % 16 if match.group(5) else ''
fg = int(match.group(4)) % 16 if match.group(4) else None
bg = int(match.group(5)) % 16 if match.group(5) else None

c.execute('''
SELECT * FROM rss_feeds WHERE channel = {0} AND feed_name = {0}
Expand Down

0 comments on commit 16ee5af

Please sign in to comment.