Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FoD
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Schmitz
FoD
Commits
46c99f26
Commit
46c99f26
authored
2 years ago
by
David Schmitz
Browse files
Options
Downloads
Patches
Plain Diff
fix/prefix_overlap_handling: fix url escaped formatting with newer Django version
parent
4ceda3ff
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
flowspec/forms.py
+4
-2
4 additions, 2 deletions
flowspec/forms.py
with
4 additions
and
2 deletions
flowspec/forms.py
+
4
−
2
View file @
46c99f26
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
from
django
import
forms
from
django
import
forms
from
django.utils.safestring
import
mark_safe
from
django.utils.safestring
import
mark_safe
from
django.utils.html
import
format_html
from
django.utils.translation
import
ugettext
as
_
from
django.utils.translation
import
ugettext
as
_
from
django.utils.translation
import
ugettext_lazy
from
django.utils.translation
import
ugettext_lazy
from
django.template.defaultfilters
import
filesizeformat
from
django.template.defaultfilters
import
filesizeformat
...
@@ -217,10 +218,11 @@ class RouteForm(forms.ModelForm):
...
@@ -217,10 +218,11 @@ class RouteForm(forms.ModelForm):
existing_url
=
reverse
(
'
edit-route
'
,
args
=
[
route
.
name
])
existing_url
=
reverse
(
'
edit-route
'
,
args
=
[
route
.
name
])
net_route_destination
=
ip_network
(
route
.
destination
,
strict
=
False
)
net_route_destination
=
ip_network
(
route
.
destination
,
strict
=
False
)
#if net_destination==net_route_destination or net_destination in net_route_destination or net_route_destination in net_destination:
#if net_destination==net_route_destination or net_destination in net_route_destination or net_route_destination in net_destination:
route_name_fmted
=
format_html
(
route
.
name
)
if
net_destination
==
net_route_destination
:
if
net_destination
==
net_route_destination
:
raise
forms
.
ValidationError
(
'
Found an exactly matching %s rule, %s with destination prefix %s<br>To avoid overlapping try editing rule <a href=
\'
%s
\'
>%s</a>
'
%
(
route
.
status
,
route
.
name
,
route
.
destination
,
existing_url
,
route
.
name
))
raise
forms
.
ValidationError
(
mark_safe
(
'
Found an exactly matching %s rule, %s with destination prefix %s<br>To avoid overlapping try editing rule <a href=
\'
%s
\'
>%s</a>
'
%
(
route
.
status
,
route
_
name
_fmted
,
route
.
destination
,
existing_url
,
route
_
name
_fmted
)
))
elif
net_destination
.
overlaps
(
net_route_destination
):
elif
net_destination
.
overlaps
(
net_route_destination
):
raise
forms
.
ValidationError
(
'
Found an overlapping %s rule, %s with destination prefix %s<br>To avoid overlapping try editing rule <a href=
\'
%s
\'
>%s</a>
'
%
(
route
.
status
,
route
.
name
,
route
.
destination
,
existing_url
,
route
.
name
))
raise
forms
.
ValidationError
(
mark_safe
(
'
Found an overlapping %s rule, %s with destination prefix %s<br>To avoid overlapping try editing rule <a href=
\'
%s
\'
>%s</a>
'
%
(
route
.
status
,
route
_
name
_fmted
,
route
.
destination
,
existing_url
,
route
_
name
_fmted
)
))
return
self
.
cleaned_data
return
self
.
cleaned_data
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment