# HG changeset patch # User Marcin Kuzminski # Date 1274554054 -7200 # Node ID 78e406a4c58eafad631045002ccb4b4ec29a091f # Parent c097458480a5972dd75d5695b61e855fd0ab371e moved checking for user in session to wrapper function of LoginRequired decorator since it was working quite strange. diff -r c097458480a5 -r 78e406a4c58e pylons_app/lib/auth.py --- a/pylons_app/lib/auth.py Sat May 22 19:30:20 2010 +0200 +++ b/pylons_app/lib/auth.py Sat May 22 20:47:34 2010 +0200 @@ -41,7 +41,7 @@ """ A simple object that handles a mercurial username for authentication """ - username = 'Empty' + username = 'None' is_authenticated = False is_admin = False permissions = set() @@ -61,16 +61,17 @@ pass def __call__(self, func): - user = session.get('hg_app_user', AuthUser()) - log.info('Checking login required for %s', user.username) @wraps(func) def _wrapper(*fargs, **fkwargs): + user = session.get('hg_app_user', AuthUser()) + log.info('Checking login required for user:%s', user.username) if user.is_authenticated: log.info('user %s is authenticated', user.username) func(*fargs) else: logging.info('user %s not authenticated', user.username) + logging.info('redirecting to login page') return redirect(url('login_home')) return _wrapper