Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
668d3099
authored
Oct 30, 2013
by
Dudás Ádám
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fw: simplyfy method for mccabe
parent
34b69cf4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
11 deletions
+15
-11
circle/firewall/models.py
+15
-11
No files found.
circle/firewall/models.py
View file @
668d3099
...
...
@@ -691,18 +691,22 @@ class Record(models.Model):
"""Validate a record."""
if
not
self
.
address
:
raise
ValidationError
(
_
(
"Address must be specified!"
))
if
self
.
type
==
'A'
:
val_ipv4
(
self
.
address
)
elif
self
.
type
==
'AAAA'
:
val_ipv6
(
self
.
address
)
elif
self
.
type
in
[
'CNAME'
,
'NS'
,
'PTR'
]:
val_domain
(
self
.
address
)
elif
self
.
type
==
'MX'
:
val_mx
(
self
.
address
)
elif
self
.
type
==
'TXT'
:
pass
else
:
try
:
validator
=
{
'A'
:
val_ipv4
,
'AAAA'
:
val_ipv6
,
'CNAME'
:
val_domain
,
'MX'
:
val_mx
,
'NS'
:
val_domain
,
'PTR'
:
val_domain
,
'TXT'
:
None
,
}[
self
.
type
]
except
KeyError
:
raise
ValidationError
(
_
(
"Unknown record type."
))
else
:
if
validator
:
validator
(
self
.
address
)
def
clean
(
self
):
"""Validate the Record to be saved.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment