issue 596, thanks Iceberg

This commit is contained in:
Massimo Di Pierro
2012-01-12 12:45:15 -06:00
parent c9da054d4f
commit 2e75450339
2 changed files with 6 additions and 11 deletions
+1 -1
View File
@@ -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
View File
@@ -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)