Add float and percent types for FieldAttributes

Also sets the max_fail_percentage value to the percent type.
pull/12113/head
James Cammarata 9 years ago
parent 9f95720ef7
commit af41ba929c

@ -289,8 +289,16 @@ class Base:
value = unicode(value)
elif attribute.isa == 'int':
value = int(value)
elif attribute.isa == 'float':
value = float(value)
elif attribute.isa == 'bool':
value = boolean(value)
elif attribute.isa == 'percent':
# special value, which may be an integer or float
# with an optional '%' at the end
if isinstance(value, string_types) and '%' in value:
value = value.replace('%', '')
value = float(value)
elif attribute.isa == 'list':
if value is None:
value = []

@ -78,7 +78,7 @@ class Play(Base, Taggable, Become):
# Flag/Setting Attributes
_any_errors_fatal = FieldAttribute(isa='bool', default=False)
_force_handlers = FieldAttribute(isa='bool')
_max_fail_percentage = FieldAttribute(isa='string', default='0')
_max_fail_percentage = FieldAttribute(isa='percent')
_serial = FieldAttribute(isa='int', default=0)
_strategy = FieldAttribute(isa='string', default='linear')

Loading…
Cancel
Save