예제 #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)