mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-16 20:48:17 -06:00
#8233 Fix PEP8 compliances
This commit is contained in:
parent
a37d0897c2
commit
a8114e9c53
@ -37,7 +37,6 @@ class TokenAuthentication(authentication.TokenAuthentication):
|
||||
if not token.validateclientip(clientip):
|
||||
raise exceptions.AuthenticationFailed(f"Source IP {clientip} is not allowed to use this token.")
|
||||
|
||||
|
||||
# Enforce the Token's expiration time, if one has been set.
|
||||
if token.is_expired:
|
||||
raise exceptions.AuthenticationFailed("Token expired")
|
||||
|
@ -257,7 +257,7 @@ class Token(BigIDModel):
|
||||
raise ValidationError()
|
||||
else:
|
||||
iptest = ipaddress.ip_address(ip)
|
||||
except:
|
||||
except ValueError:
|
||||
raise ValidationError(f"{ip} is an invalid value in the Allowed IP Ranges ({ip_addresses})")
|
||||
|
||||
return True
|
||||
@ -271,7 +271,7 @@ class Token(BigIDModel):
|
||||
|
||||
try:
|
||||
ip_address = ipaddress.ip_address(raw_ip_address)
|
||||
except:
|
||||
except ValueError:
|
||||
raise ValidationError(f"{raw_ip_address} is an invalid IP address")
|
||||
|
||||
for ip in self.allowed_ipranges.split(','):
|
||||
@ -291,6 +291,7 @@ class Token(BigIDModel):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
#
|
||||
# Permissions
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user