diff options
author | Michael Elkins <melkins@tislabs.com> | 2010-07-13 16:36:14 +0000 |
---|---|---|
committer | Michael Elkins <melkins@tislabs.com> | 2010-07-13 16:36:14 +0000 |
commit | 1a98378aeb4bc172c17917b13d489f5f6ac9f385 (patch) | |
tree | 943ff0ebf698ae4525ae2d2d13c5228cb08fb854 /portal-gui/rpkigui/myrpki/misc.py | |
parent | c43b89cb988f8d1ebd028562c443de26dd6c58b9 (diff) |
change prefix split form to accept single input box in which the user can enter a CIDR or range
remove hyperlinks for roa/delete when the prefix has been allocated to a child
svn path=/portal-gui/rpkigui/myrpki/forms.py; revision=3398
Diffstat (limited to 'portal-gui/rpkigui/myrpki/misc.py')
-rw-r--r-- | portal-gui/rpkigui/myrpki/misc.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/portal-gui/rpkigui/myrpki/misc.py b/portal-gui/rpkigui/myrpki/misc.py index 125547a6..16954d87 100644 --- a/portal-gui/rpkigui/myrpki/misc.py +++ b/portal-gui/rpkigui/myrpki/misc.py @@ -28,4 +28,14 @@ def str_to_range(lo, hi): else: return rpki.resource_set.resource_range_ipv6(x, y) +def parse_resource_range(s): + '''Parse an IPv4/6 resource range.''' + # resource_set functions only accept str + if isinstance(s, unicode): + s = s.encode() + try: + return rpki.resource_set.resource_range_ipv4.parse_str(s) + except ValueError: + return rpki.resource_set.resource_range_ipv6.parse_str(s) + # vim:sw=4 ts=8 expandtab |