From 6d08aa86189e0b74a2c1eb3f0cf4f9130fde7c26 Mon Sep 17 00:00:00 2001 From: David Schmitz <schmitz@lrz.de> Date: Tue, 9 Oct 2018 14:28:26 +0200 Subject: [PATCH] fix a whitespace issue --- flowspec/validators.py | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/flowspec/validators.py b/flowspec/validators.py index 45198065..4e2daab4 100644 --- a/flowspec/validators.py +++ b/flowspec/validators.py @@ -196,23 +196,23 @@ def check_if_rule_exists(fields, queryset): """ if not settings.DISABLE_RULE_OVERLAP_CHECK: - routes = queryset.filter( - source=fields.get('source'), - destination=IPNetwork(fields.get('destination')).compressed, - ) - if routes: - ids = [str(item[0]) for item in routes.values_list('pk')] - return ( - True, _('Rule(s) regarding those addresses already exist ' - 'with id(s) {}. Please edit those instead'.format(', '.join(ids)))) - - routes = Route.objects.filter( - source=fields.get('source'), - destination=IPNetwork(fields.get('destination')).compressed, - ) - for route in routes: - return ( - True, _('Rule(s) regarding those addresses already exist ' - 'but you cannot edit them. Please refer to the ' - 'application\'s administrators for further clarification')) + routes = queryset.filter( + source=fields.get('source'), + destination=IPNetwork(fields.get('destination')).compressed, + ) + if routes: + ids = [str(item[0]) for item in routes.values_list('pk')] + return ( + True, _('Rule(s) regarding those addresses already exist ' + 'with id(s) {}. Please edit those instead'.format(', '.join(ids)))) + + routes = Route.objects.filter( + source=fields.get('source'), + destination=IPNetwork(fields.get('destination')).compressed, + ) + for route in routes: + return ( + True, _('Rule(s) regarding those addresses already exist ' + 'but you cannot edit them. Please refer to the ' + 'application\'s administrators for further clarification')) return (False, None) -- GitLab