Replace Integer to Number in Type check

There is no Integer type in Heat template, so we should use Number
instead. See Heat parameters documentation
http://docs.openstack.org/developer/heat/template_guide/hot_spec.html#hot-spec-parameters

IntegerField replaced to FloatField, because Number can store floating
point values too.

Add Type to ValueError message

Change-Id: I74935c7c04cdd980ecc540f14baffbb4d115908c
This commit is contained in:
Victor Sergeyev 2014-04-23 13:47:18 +03:00
parent 288a6ee498
commit c42c0f2c88

View File

@ -31,10 +31,11 @@ def make_field(name, Type, NoEcho, Default, Description, AllowedValues=None,
attrs['placeholder'] = _("auto-generate")
if Type == 'String':
Field = django.forms.CharField
elif Type == 'Integer':
Field = django.forms.IntegerField
elif Type == 'Number':
Field = django.forms.FloatField
else:
raise ValueError("Unsupported parameter type in Heat template.")
raise ValueError(
"Unsupported parameter type %r in Heat template." % Type)
if NoEcho == 'true':
Widget = django.forms.PasswordInput
widget_kwargs['render_value'] = True