issue 596, thanks Iceberg
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 1.99.4 (2012-01-12 12:38:47) stable
|
Version 1.99.4 (2012-01-12 12:45:12) stable
|
||||||
|
|||||||
+5
-10
@@ -2517,16 +2517,11 @@ class Auth(object):
|
|||||||
self.settings.login_url+\
|
self.settings.login_url+\
|
||||||
'?_next='+urllib.quote(next))
|
'?_next='+urllib.quote(next))
|
||||||
|
|
||||||
#Check condition variable.
|
if callable(condition):
|
||||||
#Since condition could be callable, following cases could occur:
|
flag = condition()
|
||||||
# 1. condition == True => ok
|
else:
|
||||||
# 2. condition == False => failed
|
flag = condition
|
||||||
# 3. condition is NOT callable but it NOT None and NOT False and NOT 0 => failed
|
if not flag:
|
||||||
# 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:
|
|
||||||
current.session.flash = self.messages.access_denied
|
current.session.flash = self.messages.access_denied
|
||||||
return call_or_redirect(
|
return call_or_redirect(
|
||||||
self.settings.on_failed_authorization)
|
self.settings.on_failed_authorization)
|
||||||
|
|||||||
Reference in New Issue
Block a user