mirror of
https://github.com/jazzband/django-axes.git
synced 2026-05-08 15:44:46 +00:00
Use plain names for tier helper functions
This commit is contained in:
parent
546cf4df0c
commit
039c97455e
2 changed files with 4 additions and 4 deletions
|
|
@ -211,7 +211,7 @@ def axes_lockout_tiers_check(app_configs, **kwargs): # pylint: disable=unused-a
|
|||
if tiers is None:
|
||||
return warnings
|
||||
|
||||
if not _is_valid_tiers_list(tiers):
|
||||
if not is_valid_tiers_list(tiers):
|
||||
warnings.append(
|
||||
Warning(
|
||||
msg=Messages.LOCKOUT_TIERS_INVALID,
|
||||
|
|
@ -233,7 +233,7 @@ def axes_lockout_tiers_check(app_configs, **kwargs): # pylint: disable=unused-a
|
|||
return warnings
|
||||
|
||||
|
||||
def _is_valid_tiers_list(tiers) -> bool:
|
||||
def is_valid_tiers_list(tiers) -> bool:
|
||||
if not isinstance(tiers, (list, tuple)):
|
||||
return False
|
||||
return all(isinstance(t, LockoutTier) for t in tiers)
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ def get_cool_off(request: Optional[HttpRequest] = None) -> Optional[timedelta]:
|
|||
:exception TypeError: if settings.AXES_COOLOFF_TIME is of wrong type.
|
||||
"""
|
||||
|
||||
tier = _resolve_tier_from_request(request)
|
||||
tier = resolve_tier_from_request(request)
|
||||
if tier is not None:
|
||||
return tier.cooloff
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ def get_lockout_tier(failures: int) -> Optional[LockoutTier]:
|
|||
return matched
|
||||
|
||||
|
||||
def _resolve_tier_from_request(
|
||||
def resolve_tier_from_request(
|
||||
request: Optional[HttpRequest],
|
||||
) -> Optional[LockoutTier]:
|
||||
"""Extract failure count from *request* and resolve the tier."""
|
||||
|
|
|
|||
Loading…
Reference in a new issue