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
This commit is contained in:
Lynn Root
2012-12-11 10:52:06 +01:00
committed by Martin Kosek
parent 585b91df3b
commit 173ee4d141
8 changed files with 43 additions and 47 deletions
+3 -3
View File
@@ -267,7 +267,7 @@ def _create_zone_serial():
def _reverse_zone_name(netstr):
try:
netaddr.IPAddress(netstr)
netaddr.IPAddress(str(netstr))
except (netaddr.AddrFormatError, ValueError):
pass
else:
@@ -285,7 +285,7 @@ def _reverse_zone_name(netstr):
def _validate_ipaddr(ugettext, ipaddr, ip_version=None):
try:
ip = netaddr.IPAddress(ipaddr, flags=netaddr.INET_PTON)
ip = netaddr.IPAddress(str(ipaddr), flags=netaddr.INET_PTON)
if ip_version is not None:
if ip.version != ip_version:
@@ -454,7 +454,7 @@ def add_forward_record(zone, name, str_address):
pass # the entry already exists and matches
def get_reverse_zone(ipaddr, prefixlen=None):
ip = netaddr.IPAddress(ipaddr)
ip = netaddr.IPAddress(str(ipaddr))
revdns = unicode(ip.reverse_dns)
if prefixlen is None: