Safe call is useless here + some refactoring

This commit is contained in:
Théo Piboubès
2015-08-09 23:32:17 +02:00
parent be7cd1a071
commit 0274823b7e
2 changed files with 7 additions and 7 deletions

View File

@@ -368,21 +368,22 @@ class SubredditContent(BaseContent):
return data
class SubscriptionContent(BaseContent):
def __init__(self, subscriptions, loader):
self.name = "Subscriptions"
def __init__(self, name, subscriptions, loader):
self.name = name
self._loader = loader
self._subscriptions = subscriptions
self._subscription_data = []
@classmethod
def get_list(cls, reddit, loader):
display_name = "Subscriptions"
try:
with loader():
subscriptions = reddit.get_my_subreddits(limit=None)
except praw.errors.APIException:
raise SubscriptionError()
return cls(subscriptions, loader)
return cls(display_name, subscriptions, loader)
def get(self, index, n_cols=70):
"""

View File

@@ -167,10 +167,9 @@ class SubredditPage(BasePage):
show_notification(self.stdscr, ['Not logged in'])
return
with self.safe_call as s:
page = SubscriptionPage(self.stdscr, self.reddit)
page.loop()
self.refresh_content()
page = SubscriptionPage(self.stdscr, self.reddit)
page.loop()
self.refresh_content()
@staticmethod
def draw_item(win, data, inverted=False):