summaryrefslogtreecommitdiffstats
path: root/ipapython/ipautil.py
diff options
context:
space:
mode:
authorLynn Root <lroot@redhat.com>2012-11-08 10:06:35 -0500
committerMartin Kosek <mkosek@redhat.com>2012-12-11 10:52:06 +0100
commit173ee4d141958f198a706d65d4ee47c4a2ec31ed (patch)
treef03ad715dfa5f57ce676327f709831264d54612f /ipapython/ipautil.py
parent585b91df3b1fab9c865e00f522950003709ea23d (diff)
downloadfreeipa-173ee4d141958f198a706d65d4ee47c4a2ec31ed.tar.gz
freeipa-173ee4d141958f198a706d65d4ee47c4a2ec31ed.tar.xz
freeipa-173ee4d141958f198a706d65d4ee47c4a2ec31ed.zip
Switch %r specifiers to '%s' in Public errors
This switch drops the preceding 'u' from strings within Public error messages. This patch also addresses the related unfriendly 'u' from re-raising errors from netaddr.IPAddress by passing a bytestring through the function. Also switched ValidationError to TypeError in validate_scalar per jcholast@redhat.com. Ticket: https://fedorahosted.org/freeipa/ticket/3121 Ticket: https://fedorahosted.org/freeipa/ticket/2588
Diffstat (limited to 'ipapython/ipautil.py')
-rw-r--r--ipapython/ipautil.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py
index 1053fc665..fbb3c26d8 100644
--- a/ipapython/ipautil.py
+++ b/ipapython/ipautil.py
@@ -103,7 +103,7 @@ class CheckedIPAddress(netaddr.IPAddress):
else:
try:
try:
- addr = netaddr.IPAddress(addr, flags=self.netaddr_ip_flags)
+ addr = netaddr.IPAddress(str(addr), flags=self.netaddr_ip_flags)
except netaddr.AddrFormatError:
# netaddr.IPAddress doesn't handle zone indices in textual
# IPv6 addresses. Try removing zone index and parse the
@@ -113,11 +113,11 @@ class CheckedIPAddress(netaddr.IPAddress):
addr, sep, foo = addr.partition('%')
if sep != '%':
raise
- addr = netaddr.IPAddress(addr, flags=self.netaddr_ip_flags)
+ addr = netaddr.IPAddress(str(addr), flags=self.netaddr_ip_flags)
if addr.version != 6:
raise
except ValueError:
- net = netaddr.IPNetwork(addr, flags=self.netaddr_ip_flags)
+ net = netaddr.IPNetwork(str(addr), flags=self.netaddr_ip_flags)
if not parse_netmask:
raise ValueError("netmask and prefix length not allowed here")
addr = net.ip