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