[PATCH 3/3] Add parameters to format strings
David Shea
dshea at redhat.com
Tue Sep 10 16:10:15 UTC 2013
---
pyanaconda/bootloader.py | 10 +++++-----
pyanaconda/ui/gui/spokes/storage.py | 5 +++--
pyanaconda/ui/tui/spokes/network.py | 10 ++++++----
3 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
index 276dd76..55a93a2 100644
--- a/pyanaconda/bootloader.py
+++ b/pyanaconda/bootloader.py
@@ -395,9 +395,9 @@ class BootLoader(object):
# new arrays will be created with an appropriate metadata format
if device.exists and \
metadata and device.metadataVersion not in metadata:
- self.errors.append(_("RAID sets that contain '%s' must have one "
- "of the following metadata versions: %s.")
- % (desc, ",".join(metadata)))
+ self.errors.append(_("RAID sets that contain '%(desc)s' must have one "
+ "of the following metadata versions: %(metadata_versions)s.")
+ % {"desc": desc, "metadata_versions": ",".join(metadata)})
ret = False
if member_types:
@@ -482,8 +482,8 @@ class BootLoader(object):
sector_size = device.partedPartition.disk.device.sectorSize
end_mb = (sector_size * end_sector) / (1024.0 * 1024.0)
if end_mb > max_mb:
- self.errors.append(_("%s must be within the first %dMB of "
- "the disk.") % (desc, max_mb))
+ self.errors.append(_("%(desc)s must be within the first %(max_mb)dMB of "
+ "the disk.") % {"desc": desc, "max_mb": max_mb})
ret = False
log.debug("_is_valid_location(%s) returning %s", device.name, ret)
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index 41f65f1..12e8ebd 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -287,11 +287,12 @@ class InstallOptions3Dialog(InstallOptions1Dialog):
self._set_free_space_labels(disk_free, fs_free)
label_text = _("<b>You don't have enough space available to install "
- "%s</b>, even if you used all of the free space "
+ "%(productName)s</b>, even if you used all of the free space "
"available on the selected disks. You could add more "
"disks for additional space, "
"modify your software selection to install a smaller "
- "version of <b>%s</b>, or quit the installer.") % (productName, productName)
+ "version of <b>%(productName)s</b>, or quit the installer.") % \
+ {"productName": productName}
self.builder.get_object("options3_label2").set_markup(label_text)
self._add_modify_watcher("options3_label1")
diff --git a/pyanaconda/ui/tui/spokes/network.py b/pyanaconda/ui/tui/spokes/network.py
index cdd9209..1f56eb3 100644
--- a/pyanaconda/ui/tui/spokes/network.py
+++ b/pyanaconda/ui/tui/spokes/network.py
@@ -119,7 +119,8 @@ class NetworkSpoke(EditTUISpoke):
dnss_str = ",".join(ipv4config[1])
else:
addr_str = dnss_str = gateway_str = netmask_str = ""
- msg += _(" IPv4 Address: %s Netmask: %s Gateway: %s\n") % (addr_str, netmask_str, gateway_str)
+ msg += _(" IPv4 Address: %(addr)s Netmask: %(netmask)s Gateway: %(gateway)s\n") % \
+ {"addr": addr_str, "netmask": netmask_str, "gateway": gateway_str}
msg += _(" DNS: %s\n") % dnss_str
if ipv6config and ipv6config[0]:
@@ -127,7 +128,8 @@ class NetworkSpoke(EditTUISpoke):
addr_str, prefix, gateway_str = ipv6addr
# Do not display link-local addresses
if not addr_str.startswith("fe80:"):
- msg += _(" IPv6 Address: %s/%d\n") % (addr_str, prefix)
+ msg += _(" IPv6 Address: %(addr)s/%(prefix)d\n") % \
+ {"addr": addr_str, "prefix": prefix}
dnss_str = ",".join(ipv6config[1])
@@ -266,8 +268,8 @@ class ConfigureNetworkSpoke(EditTUISpoke):
re.compile("^" + IPV4_PATTERN_WITHOUT_ANCHORS + "|dhcp$"), True),
Entry(_("IPv4 netmask"), "netmask", re.compile("^" + IPV4_PATTERN_WITHOUT_ANCHORS + "$"), True),
Entry(_("IPv4 gateway"), "gateway", re.compile("^" + IPV4_PATTERN_WITHOUT_ANCHORS + "$"), True),
- Entry(_('IPv6 address or %s for automatic, %s for DHCP, %s to turn off')
- % ('"auto"', '"dhcp"', '"ignore"'), "ipv6",
+ Entry(_('IPv6 address or %(auto)s for automatic, %(dhcp)s for DHCP, %(ignore)s to turn off')
+ % {"auto": '"auto"', "dhcp": '"dhcp"', "ignore": '"ignore"'}, "ipv6",
Fake_RE_IPV6(allow_prefix=True, whitelist=["auto", "dhcp", "ignore"]), True),
Entry(_("IPv6 default gateway"), "ipv6gateway", re.compile(".*$"), True),
Entry(_("Nameservers (comma separated)"), "nameserver", re.compile(".*$"), True),
--
1.8.3.1
More information about the anaconda-patches
mailing list