diff --git a/VERSION b/VERSION index f6bbb979..8a599fab 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 1.99.4 (2012-01-12 12:38:47) stable +Version 1.99.4 (2012-01-12 12:45:12) stable diff --git a/gluon/tools.py b/gluon/tools.py index 81e10482..7a660672 100644 --- a/gluon/tools.py +++ b/gluon/tools.py @@ -2517,16 +2517,11 @@ class Auth(object): self.settings.login_url+\ '?_next='+urllib.quote(next)) - #Check condition variable. - #Since condition could be callable, following cases could occur: - # 1. condition == True => ok - # 2. condition == False => failed - # 3. condition is NOT callable but it NOT None and NOT False and NOT 0 => failed - # 4. condition is callable -> condition() is True => ok - # 5. condition is callable -> condition() is False => failed - # Note: Order is important! At the end condition has to be checked against True - # otherwise case 3 would be ok. - if not (callable(condition) and condition() == True) and not condition == True: + if callable(condition): + flag = condition() + else: + flag = condition + if not flag: current.session.flash = self.messages.access_denied return call_or_redirect( self.settings.on_failed_authorization)