content.py: empty flair case fixed

x-post and self post are now consistent
This commit is contained in:
Gustavo Zambonin
2015-10-14 18:54:21 -03:00
parent 2358eed46e
commit 21d5c7acca

View File

@@ -131,7 +131,7 @@ class BaseContent(object):
data['flair'] = flair data['flair'] = flair
data['url_full'] = sub.url data['url_full'] = sub.url
if flair is not None and flair[0] != '[': if flair and not flair.startswith('['):
data['flair'] = '[{}]'.format(flair.strip()) data['flair'] = '[{}]'.format(flair.strip())
if data['permalink'].split('/r/')[-1] == data['url_full'].split('/r/')[-1]: if data['permalink'].split('/r/')[-1] == data['url_full'].split('/r/')[-1]:
@@ -140,7 +140,7 @@ class BaseContent(object):
elif reddit_link.match(data['url_full']): elif reddit_link.match(data['url_full']):
data['url_type'] = 'x-post' data['url_type'] = 'x-post'
data['url'] = 'x-post via {}'.format(strip_subreddit_url(data['url_full'])) data['url'] = 'x-post via {}'.format(data['subreddit'])
else: else:
data['url_type'] = 'external' data['url_type'] = 'external'
@@ -167,6 +167,7 @@ class BaseContent(object):
return data return data
class SubmissionContent(BaseContent): class SubmissionContent(BaseContent):
""" """
Grab a submission from PRAW and lazily store comments to an internal Grab a submission from PRAW and lazily store comments to an internal
@@ -387,6 +388,7 @@ class SubredditContent(BaseContent):
return data return data
class SubscriptionContent(BaseContent): class SubscriptionContent(BaseContent):
def __init__(self, subscriptions, loader): def __init__(self, subscriptions, loader):
@@ -409,8 +411,8 @@ class SubscriptionContent(BaseContent):
def get(self, index, n_cols=70): def get(self, index, n_cols=70):
""" """
Grab the `i`th subscription, with the title field formatted to fit inside Grab the `i`th subscription, with the title field formatted to fit
of a window of width `n_cols` inside of a window of width `n_cols`
""" """
if index < 0: if index < 0: