Fixes bug #10281 - Trailing zeros were truncated from strings

pull/10313/head
Alvaro Lopez Ortega 10 years ago
parent a14248ffe1
commit 2e929cf0ce

@ -54,11 +54,11 @@ class InventoryParser(object):
def _parse_value(v): def _parse_value(v):
if "#" not in v: if "#" not in v:
try: try:
re = ast.literal_eval(v) ret = ast.literal_eval(v)
if type(re) == float: if type(ret) == float:
# Do not trim floats. Eg: "1.20" to 1.2 # Do not trim floats. Eg: "1.20" to 1.2
return v return v
return re return ret
# Using explicit exceptions. # Using explicit exceptions.
# Likely a string that literal_eval does not like. We wil then just set it. # Likely a string that literal_eval does not like. We wil then just set it.
except ValueError: except ValueError:

Loading…
Cancel
Save