Minor style changes.
This commit is contained in:
@@ -135,21 +135,19 @@ class BaseContent(object):
|
|||||||
data['nsfw'] = sub.over_18
|
data['nsfw'] = sub.over_18
|
||||||
data['index'] = None # This is filled in later by the method caller
|
data['index'] = None # This is filled in later by the method caller
|
||||||
|
|
||||||
if flair and not flair.startswith('['):
|
if data['flair'] and not data['flair'].startswith('['):
|
||||||
data['flair'] = '[{}]'.format(flair.strip())
|
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_type'] = 'selfpost'
|
||||||
data['url'] = 'self.{}'.format(data['subreddit'])
|
data['url'] = 'self.{}'.format(data['subreddit'])
|
||||||
|
elif reddit_link.match(url_full):
|
||||||
elif reddit_link.match(data['url_full']):
|
|
||||||
data['url_type'] = 'x-post'
|
data['url_type'] = 'x-post'
|
||||||
data['url'] = 'self.{}'.format(strip_subreddit_url(
|
data['url'] = 'self.{}'.format(strip_subreddit_url(url_full)[3:])
|
||||||
data['url_full'])[3:])
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
data['url_type'] = 'external'
|
data['url_type'] = 'external'
|
||||||
data['url'] = data['url_full']
|
data['url'] = url_full
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ class OAuthTool(object):
|
|||||||
except (praw.errors.OAuthAppRequired, praw.errors.OAuthInvalidToken):
|
except (praw.errors.OAuthAppRequired, praw.errors.OAuthInvalidToken):
|
||||||
show_notification(self.stdscr, ['Invalid OAuth data'])
|
show_notification(self.stdscr, ['Invalid OAuth data'])
|
||||||
else:
|
else:
|
||||||
message = ['Welcome, {}!'.format(self.reddit.user.name)]
|
message = ['Welcome {}!'.format(self.reddit.user.name)]
|
||||||
show_notification(self.stdscr, message)
|
show_notification(self.stdscr, message)
|
||||||
|
|
||||||
def clear_oauth_data(self):
|
def clear_oauth_data(self):
|
||||||
|
|||||||
@@ -360,7 +360,7 @@ class BasePage(object):
|
|||||||
if self.reddit.is_oauth_session():
|
if self.reddit.is_oauth_session():
|
||||||
ch = prompt_input(self.stdscr, "Log out? (y/n): ")
|
ch = prompt_input(self.stdscr, "Log out? (y/n): ")
|
||||||
if ch == 'y':
|
if ch == 'y':
|
||||||
self.reddit.clear_authentication()
|
self.oauth.clear_oauth_data()
|
||||||
show_notification(self.stdscr, ['Logged out'])
|
show_notification(self.stdscr, ['Logged out'])
|
||||||
elif ch != 'n':
|
elif ch != 'n':
|
||||||
curses.flash()
|
curses.flash()
|
||||||
|
|||||||
Reference in New Issue
Block a user