Fix PEP8 compliance

This commit is contained in:
Pieter Lambrecht 2022-03-15 11:02:33 +01:00
parent ab3db69c97
commit ed4368d6e4
2 changed files with 6 additions and 6 deletions

View File

@ -26,7 +26,7 @@ class TokenAuthentication(authentication.TokenAuthentication):
# Verify source IP is allowed # Verify source IP is allowed
request = self.request request = self.request
if len(token.allowed_ips) > 0 and request: if len(token.allowed_ips) > 0 and request:
### Replace 'HTTP_X_REAL_IP' with the settings variable choosen in #8867 # Replace 'HTTP_X_REAL_IP' with the settings variable choosen in #8867
if 'HTTP_X_REAL_IP' in request.META: if 'HTTP_X_REAL_IP' in request.META:
clientip = request.META['HTTP_X_REAL_IP'].split(",")[0].strip() clientip = request.META['HTTP_X_REAL_IP'].split(",")[0].strip()
elif 'REMOTE_ADDR' in request.META: elif 'REMOTE_ADDR' in request.META:

View File

@ -208,11 +208,11 @@ class Token(BigIDModel):
max_length=200, max_length=200,
blank=True blank=True
) )
allowed_ips = betterArrayField( allowed_ips=betterArrayField(
base_field = IPNetworkField(), base_field=IPNetworkField(),
blank = True, blank=True,
null = True, null=True,
help_text = 'Allowed IPv4/IPv6 networks from where the token can be used. Leave blank for no restrictions. Ex: "10.1.1.0/24, 192.168.10.16/32, 2001:DB8:1::/64"', help_text='Allowed IPv4/IPv6 networks from where the token can be used. Leave blank for no restrictions. Ex: "10.1.1.0/24, 192.168.10.16/32, 2001:DB8:1::/64"',
) )
class Meta: class Meta: