diff --git a/rtv/content.py b/rtv/content.py index 4e473c4..bc2314f 100644 --- a/rtv/content.py +++ b/rtv/content.py @@ -135,21 +135,19 @@ class BaseContent(object): data['nsfw'] = sub.over_18 data['index'] = None # This is filled in later by the method caller - if flair and not flair.startswith('['): - data['flair'] = '[{}]'.format(flair.strip()) + if data['flair'] and not data['flair'].startswith('['): + data['flair'] = '[{}]'.format(data['flair'].strip()) - if data['permalink'].split('/r/')[-1] == data['url_full'].split('/r/')[-1]: + url_full = data['url_full'] + if data['permalink'].split('/r/')[-1] == url_full.split('/r/')[-1]: data['url_type'] = 'selfpost' data['url'] = 'self.{}'.format(data['subreddit']) - - elif reddit_link.match(data['url_full']): + elif reddit_link.match(url_full): data['url_type'] = 'x-post' - data['url'] = 'self.{}'.format(strip_subreddit_url( - data['url_full'])[3:]) - + data['url'] = 'self.{}'.format(strip_subreddit_url(url_full)[3:]) else: data['url_type'] = 'external' - data['url'] = data['url_full'] + data['url'] = url_full return data diff --git a/rtv/oauth.py b/rtv/oauth.py index 6d73cc4..62aee86 100644 --- a/rtv/oauth.py +++ b/rtv/oauth.py @@ -106,7 +106,7 @@ class OAuthTool(object): except (praw.errors.OAuthAppRequired, praw.errors.OAuthInvalidToken): show_notification(self.stdscr, ['Invalid OAuth data']) else: - message = ['Welcome, {}!'.format(self.reddit.user.name)] + message = ['Welcome {}!'.format(self.reddit.user.name)] show_notification(self.stdscr, message) def clear_oauth_data(self): diff --git a/rtv/page.py b/rtv/page.py index 396d5f7..b16d3a5 100644 --- a/rtv/page.py +++ b/rtv/page.py @@ -360,7 +360,7 @@ class BasePage(object): if self.reddit.is_oauth_session(): ch = prompt_input(self.stdscr, "Log out? (y/n): ") if ch == 'y': - self.reddit.clear_authentication() + self.oauth.clear_oauth_data() show_notification(self.stdscr, ['Logged out']) elif ch != 'n': curses.flash()