diff options
author | Michael Elkins <melkins@tislabs.com> | 2011-01-24 21:09:36 +0000 |
---|---|---|
committer | Michael Elkins <melkins@tislabs.com> | 2011-01-24 21:09:36 +0000 |
commit | 6f9a00b15fe27c894a18e4daa5b01448589c2fe4 (patch) | |
tree | 6328d12712ccd130913be87dacd92ac502c93106 /portal-gui/rpkigui/myrpki/misc.py | |
parent | 68dfa47423d9732991ee9eacc820d38f44507581 (diff) |
move portal-gui django app to $top/rpkid/rpki/gui
change dashboard url to /rpki/
put myrpki cli path and confdir into settings.py rather than generating glue.py at build time
don't use the old myrpki images on the dashboard
no longer need to include the portal-gui python module in sys.path since it is installed in site-packages
svn path=/buildtools/subst-vars.py; revision=3646
Diffstat (limited to 'portal-gui/rpkigui/myrpki/misc.py')
-rw-r--r-- | portal-gui/rpkigui/myrpki/misc.py | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/portal-gui/rpkigui/myrpki/misc.py b/portal-gui/rpkigui/myrpki/misc.py deleted file mode 100644 index 5d3cba93..00000000 --- a/portal-gui/rpkigui/myrpki/misc.py +++ /dev/null @@ -1,47 +0,0 @@ -# $Id$ -""" -Copyright (C) 2010 SPARTA, Inc. dba Cobham Analytic Solutions - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND SPARTA DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL SPARTA BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -""" - -import rpki.resource_set -import rpki.ipaddrs - -def str_to_range(lo, hi): - """Convert IP address strings to resource_range_ip.""" - x = rpki.ipaddrs.parse(lo) - y = rpki.ipaddrs.parse(hi) - assert type(x) == type(y) - if isinstance(x, rpki.ipaddrs.v4addr): - return rpki.resource_set.resource_range_ipv4(x, y) - 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) - -def top_parent(prefix): - '''Returns the topmost resource from which the specified argument derives''' - while prefix.parent: - prefix = prefix.parent - return prefix - -# vim:sw=4 ts=8 expandtab |