[Checkins] SVN: z3c.password/branches/jw-noraise-for-irrelevant-requests/src/z3c/password/principal.py What a change a simple renaming of a method makes: suddenly the meaning of returning True or False make much more sense for the request-relevancy test.
Jan-Wijbrand Kolman
janwijbrand at gmail.com
Wed Mar 24 05:05:29 EDT 2010
Log message for revision 110143:
What a change a simple renaming of a method makes: suddenly the meaning of returning True or False make much more sense for the request-relevancy test.
Changed:
U z3c.password/branches/jw-noraise-for-irrelevant-requests/src/z3c/password/principal.py
-=-
Modified: z3c.password/branches/jw-noraise-for-irrelevant-requests/src/z3c/password/principal.py
===================================================================
--- z3c.password/branches/jw-noraise-for-irrelevant-requests/src/z3c/password/principal.py 2010-03-24 08:56:06 UTC (rev 110142)
+++ z3c.password/branches/jw-noraise-for-irrelevant-requests/src/z3c/password/principal.py 2010-03-24 09:05:28 UTC (rev 110143)
@@ -81,29 +81,29 @@
#hook to facilitate testing and easier override
return datetime.datetime.now()
- def _isIrrelevantRequest(self, RELEVANT=False, IRRELEVANT=True):
+ def _isRelevantRequest(self):
fac = self._failedAttemptCheck()
if fac is None:
- return RELEVANT
+ return True
if fac == interfaces.TML_CHECK_ALL:
- return RELEVANT
+ return True
interaction = getInteraction()
try:
request = interaction.participations[0]
except IndexError:
- return RELEVANT # no request, we regard that as relevant.
+ return True # no request, we regard that as relevant.
if fac == interfaces.TML_CHECK_NONRESOURCE:
if '/@@/' in request.getURL():
- return IRRELEVANT
- return RELEVANT
+ return False
+ return True
if fac == interfaces.TML_CHECK_POSTONLY:
if request.method == 'POST':
- return RELEVANT
- return IRRELEVANT
+ return True
+ return False
def checkPassword(self, pwd, ignoreExpiration=False, ignoreFailures=False):
# keep this as fast as possible, because it will be called (usually)
@@ -114,7 +114,7 @@
# Do not try to record failed attempts or raise account locked
# errors for requests that are irrelevant in this regard.
- if self._isIrrelevantRequest():
+ if not self._isRelevantRequest():
return same
if not ignoreFailures and self.lastFailedAttempt is not None:
More information about the checkins
mailing list