summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ipalib/parameters.py3
-rw-r--r--ipatests/test_ipalib/test_parameters.py1
2 files changed, 4 insertions, 0 deletions
diff --git a/ipalib/parameters.py b/ipalib/parameters.py
index c74686271..8d27d900a 100644
--- a/ipalib/parameters.py
+++ b/ipalib/parameters.py
@@ -1072,6 +1072,9 @@ class Int(Number):
if type(value) is unicode:
if u'.' in value:
return int(float(value))
+ if six.PY3 and re.match('0[0-9]+', value):
+ # 0-prefixed octal format
+ return int(value, 8)
return int(value, 0)
raise ValueError(value)
diff --git a/ipatests/test_ipalib/test_parameters.py b/ipatests/test_ipalib/test_parameters.py
index 845e4290d..5504a52b5 100644
--- a/ipatests/test_ipalib/test_parameters.py
+++ b/ipatests/test_ipalib/test_parameters.py
@@ -1195,6 +1195,7 @@ def check_int_scalar_conversions(o):
assert o._convert_scalar(u'16') == 16
assert o._convert_scalar(u'0x10') == 16
assert o._convert_scalar(u'020') == 16
+ assert o._convert_scalar(u'0o20') == 16
class test_IntEnum(EnumChecker):