Refactoring and making rtv OAuth-compliant

This commit is contained in:
Théo Piboubès
2015-08-17 00:36:18 +02:00
parent ef38b112a2
commit efed781fa1
8 changed files with 239 additions and 123 deletions

View File

@@ -15,14 +15,15 @@ class SubscriptionController(BaseController):
class SubscriptionPage(BasePage):
def __init__(self, stdscr, reddit):
def __init__(self, stdscr, reddit, oauth):
self.controller = SubscriptionController(self)
self.loader = LoadScreen(stdscr)
self.oauth = oauth
self.selected_subreddit_data = None
content = SubscriptionContent.from_user(reddit, self.loader)
super(SubscriptionPage, self).__init__(stdscr, reddit, content)
super(SubscriptionPage, self).__init__(stdscr, reddit, content, oauth)
def loop(self):
"Main control loop"
@@ -37,6 +38,9 @@ class SubscriptionPage(BasePage):
def refresh_content(self):
"Re-download all subscriptions and reset the page index"
# Refresh access token if expired
self.oauth.refresh()
self.content = SubscriptionContent.from_user(self.reddit, self.loader)
self.nav = Navigator(self.content.get)