コード例 #1
0
ファイル: handlers.py プロジェクト: abelenki/chrisw
  def wrapper(self, *args, **kwargs):
    """docstring for wrapper"""

    if get_current_user() != Guest:
      return func(self, *args, **kwargs)
    else:
      import home
      return self.redirect(home.create_login_url(self.request.url))
コード例 #2
0
ファイル: handlers.py プロジェクト: frankk00/chrisw
    def wrapper(self, *args, **kwargs):
        """docstring for wrapper"""

        if get_current_user() != Guest:
            return func(self, *args, **kwargs)
        else:
            import home
            return self.redirect(home.create_login_url(self.request.url))
コード例 #3
0
ファイル: handlers.py プロジェクト: abelenki/chrisw
   # fields parse fault
   error, fields_dict = 'API fields error: ' + str(e), {}
 finally:
   if error:
     action = template('page_error.html', {'error':error})
     action.status = 'error'
 
 if isinstance(action, back):
   from_url = self.request.headers.get('Referer','/')
   if from_url == self.request.url:
     action = template('page_error.html', {'error':"Visiting loop"})
   else:
     action = redirect(from_url)
 elif isinstance(action, login):
   from home import create_login_url
   action = redirect(create_login_url(self.request.url))
 elif isinstance(action, template):
   # for debugging
   # var_dict.update({'site_message':"You've created a new group."})
   pass
 elif isinstance(action, redirect) or isinstance(action, cache) or \
   isinstance(action, text):
   pass
 else:
   raise UnknownActionException(action)
 
 if result_type == 'html':
   
   if isinstance(action, redirect):
     # redirect action
     return self.redirect(action.to_url)
コード例 #4
0
ファイル: handlers.py プロジェクト: frankk00/chrisw
            error, fields_dict = 'API fields error: ' + str(e), {}
        finally:
            if error:
                action = template('page_error.html', {'error': error})
                action.status = 'error'

        if isinstance(action, back):
            from_url = self.request.headers.get('Referer', '/')
            if from_url == self.request.url:
                action = template('page_error.html',
                                  {'error': "Visiting loop"})
            else:
                action = redirect(from_url)
        elif isinstance(action, login):
            from home import create_login_url
            action = redirect(create_login_url(self.request.url))
        elif isinstance(action, template):
            # for debugging
            # var_dict.update({'site_message':"You've created a new group."})
            pass
        elif isinstance(action, redirect) or isinstance(action, cache) or \
          isinstance(action, text):
            pass
        else:
            raise UnknownActionException(action)

        if result_type == 'html':

            if isinstance(action, redirect):
                # redirect action
                return self.redirect(action.to_url)