コード例 #1
0
 def process(self, subreddit):
     try:
         _remove_subreddit(subreddit)
         directory.refresh()
     except InvalidSubreddit:
         dlg = Dialog()
         dlg.ok(_('Error'), _('There is not such subreddit.'))
         raise self.AskAgain
コード例 #2
0
 def process(self, subreddit):
     try:
         _add_subreddit(subreddit)
         directory.refresh()
     except InvalidSubreddit:
         Dialog().ok(_('Error'), _('There is not such subreddit.'))
         raise self.AskAgain
     except IsUnreachable:
         Dialog().ok(_('Information'), _('Reddit is unreachable.\n'
                     'Please check your internet connection.'))
コード例 #3
0
def remove_subreddit(subreddit=None):
    """The View removes given subreddit from user's preference list when the
    name is given.  In other case it provides a keyboard to enter a name.
    
    """
    if subreddit is not None:
        try:
            _remove_subreddit(subreddit)
            directory.refresh()
        except InvalidSubreddit:
            pass
    else:
        _RemoveView()()