Minor style changes.

This commit is contained in:
Michael Lazar
2015-10-14 23:37:16 -07:00
parent 497c7741b3
commit c4bd8aa3c3
3 changed files with 9 additions and 11 deletions

View File

@@ -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

View File

@@ -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):

View File

@@ -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()