Skip to content

Commit

Permalink
[rss] Fix default value for fg/bg. Fix sopel-irc#636
Browse files Browse the repository at this point in the history
  • Loading branch information
oklahomer committed Oct 7, 2014
1 parent df0aff5 commit f92dde2
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 f92dde2

Please sign in to comment.