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
 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.'))
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()()