[anaconda/rhel7-branch+master 4/4] Be more liberal in what is accepted as a size unit.
David Shea
dshea at redhat.com
Wed Jan 15 22:34:53 UTC 2014
Not all size specifications will end with a letter. For example: the
translation of "B" for byte in Telugu ends with a vowel sign,
categorized in Unicode as a non-spacing mark. Instead check whether the
size string ends with a [0-9]: if so, the unit is missing.
Resolves: rhbz#1039485
---
pyanaconda/ui/gui/spokes/custom.py | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index 26e56fa..2d3d5ec 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -166,14 +166,15 @@ partition_only_format_types = ["efi", "hfs+", "prepboot", "biosboot",
"appleboot"]
def size_from_entry(entry):
- size_text = entry.get_text().strip()
-
- # if no unit was specified, default to MB
- if not re.search(r'[A-Za-z]+$', size_text):
- size_text += "MB"
+ size_text = entry.get_text().decode("utf-8").strip()
try:
- size = Size(spec=size_text)
+ # if no unit was specified, default to MB. Assume that a string
+ # ending with anything other than a digit has a unit suffix
+ if size_text and not re.search(r'\d$', size_text):
+ size = Size(spec=size_text)
+ else:
+ size = Size(spec="%sMB" % size_text)
except Exception:
return None
else:
--
1.8.4.2
More information about the anaconda-patches
mailing list