Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
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
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
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):
...
@@ -691,18 +691,22 @@ class Record(models.Model):
"""Validate a record."""
"""Validate a record."""
if
not
self
.
address
:
if
not
self
.
address
:
raise
ValidationError
(
_
(
"Address must be specified!"
))
raise
ValidationError
(
_
(
"Address must be specified!"
))
if
self
.
type
==
'A'
:
val_ipv4
(
self
.
address
)
try
:
elif
self
.
type
==
'AAAA'
:
validator
=
{
val_ipv6
(
self
.
address
)
'A'
:
val_ipv4
,
elif
self
.
type
in
[
'CNAME'
,
'NS'
,
'PTR'
]:
'AAAA'
:
val_ipv6
,
val_domain
(
self
.
address
)
'CNAME'
:
val_domain
,
elif
self
.
type
==
'MX'
:
'MX'
:
val_mx
,
val_mx
(
self
.
address
)
'NS'
:
val_domain
,
elif
self
.
type
==
'TXT'
:
'PTR'
:
val_domain
,
pass
'TXT'
:
None
,
else
:
}[
self
.
type
]
except
KeyError
:
raise
ValidationError
(
_
(
"Unknown record type."
))
raise
ValidationError
(
_
(
"Unknown record type."
))
else
:
if
validator
:
validator
(
self
.
address
)
def
clean
(
self
):
def
clean
(
self
):
"""Validate the Record to be saved.
"""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