Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
df2e6481
authored
Mar 18, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall: use IPAddress.words instead of regex matching in convert_ipv4_to_ipv6()
parent
de1ac429
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
7 deletions
+5
-7
circle/firewall/fields.py
+5
-7
No files found.
circle/firewall/fields.py
View file @
df2e6481
...
@@ -263,10 +263,8 @@ def val_mx(value):
...
@@ -263,10 +263,8 @@ def val_mx(value):
def
convert_ipv4_to_ipv6
(
ipv6_template
,
ipv4
):
def
convert_ipv4_to_ipv6
(
ipv6_template
,
ipv4
):
"""Convert IPv4 address string to IPv6 address string."""
"""Convert IPv4 address string to IPv6 address string."""
ipv4
=
str
(
ipv4
)
m
=
ipv4
.
words
val_ipv4
(
ipv4
)
return
IPAddress
(
ipv6_template
%
{
'a'
:
int
(
m
[
0
]),
m
=
ipv4_re
.
match
(
ipv4
)
'b'
:
int
(
m
[
1
]),
return
IPAddress
(
ipv6_template
%
{
'a'
:
int
(
m
.
group
(
1
)),
'c'
:
int
(
m
[
2
]),
'b'
:
int
(
m
.
group
(
2
)),
'd'
:
int
(
m
[
3
])})
'c'
:
int
(
m
.
group
(
3
)),
'd'
:
int
(
m
.
group
(
4
))})
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