Merge "Remove redundant VersionedObject Fields"
This commit is contained in:
commit
a4bab65ace
@ -39,8 +39,10 @@ ElementTypeError = fields.ElementTypeError
|
||||
BooleanField = fields.BooleanField
|
||||
UnspecifiedDefault = fields.UnspecifiedDefault
|
||||
IntegerField = fields.IntegerField
|
||||
NonNegativeIntegerField = fields.NonNegativeIntegerField
|
||||
UUIDField = fields.UUIDField
|
||||
FloatField = fields.FloatField
|
||||
NonNegativeFloatField = fields.NonNegativeFloatField
|
||||
StringField = fields.StringField
|
||||
SensitiveStringField = fields.SensitiveStringField
|
||||
EnumField = fields.EnumField
|
||||
@ -61,6 +63,7 @@ DictOfListOfStringsField = fields.DictOfListOfStringsField
|
||||
IPAddressField = fields.IPAddressField
|
||||
IPV4AddressField = fields.IPV4AddressField
|
||||
IPV6AddressField = fields.IPV6AddressField
|
||||
IPV4AndV6AddressField = fields.IPV4AndV6AddressField
|
||||
IPNetworkField = fields.IPNetworkField
|
||||
IPV4NetworkField = fields.IPV4NetworkField
|
||||
IPV6NetworkField = fields.IPV6NetworkField
|
||||
@ -673,17 +676,6 @@ class InstancePowerState(Enum):
|
||||
return cls.ALL[index]
|
||||
|
||||
|
||||
class IPV4AndV6Address(IPAddress):
|
||||
@staticmethod
|
||||
def coerce(obj, attr, value):
|
||||
result = IPAddress.coerce(obj, attr, value)
|
||||
if result.version != 4 and result.version != 6:
|
||||
raise ValueError(_('Network "%(val)s" is not valid '
|
||||
'in field %(attr)s') %
|
||||
{'val': value, 'attr': attr})
|
||||
return result
|
||||
|
||||
|
||||
class NetworkModel(FieldType):
|
||||
@staticmethod
|
||||
def coerce(obj, attr, value):
|
||||
@ -709,24 +701,6 @@ class NetworkModel(FieldType):
|
||||
','.join([str(vif['id']) for vif in value]))
|
||||
|
||||
|
||||
class NonNegativeFloat(FieldType):
|
||||
@staticmethod
|
||||
def coerce(obj, attr, value):
|
||||
v = float(value)
|
||||
if v < 0:
|
||||
raise ValueError(_('Value must be >= 0 for field %s') % attr)
|
||||
return v
|
||||
|
||||
|
||||
class NonNegativeInteger(FieldType):
|
||||
@staticmethod
|
||||
def coerce(obj, attr, value):
|
||||
v = int(value)
|
||||
if v < 0:
|
||||
raise ValueError(_('Value must be >= 0 for field %s') % attr)
|
||||
return v
|
||||
|
||||
|
||||
class AddressBase(FieldType):
|
||||
@staticmethod
|
||||
def coerce(obj, attr, value):
|
||||
@ -924,17 +898,5 @@ class InstancePowerStateField(BaseEnumField):
|
||||
AUTO_TYPE = InstancePowerState()
|
||||
|
||||
|
||||
class IPV4AndV6AddressField(AutoTypedField):
|
||||
AUTO_TYPE = IPV4AndV6Address()
|
||||
|
||||
|
||||
class ListOfIntegersField(AutoTypedField):
|
||||
AUTO_TYPE = List(fields.Integer())
|
||||
|
||||
|
||||
class NonNegativeFloatField(AutoTypedField):
|
||||
AUTO_TYPE = NonNegativeFloat()
|
||||
|
||||
|
||||
class NonNegativeIntegerField(AutoTypedField):
|
||||
AUTO_TYPE = NonNegativeInteger()
|
||||
|
@ -230,7 +230,7 @@ class TestInteger(TestField):
|
||||
class TestNonNegativeInteger(TestInteger):
|
||||
def setUp(self):
|
||||
super(TestNonNegativeInteger, self).setUp()
|
||||
self.field = fields.Field(fields.NonNegativeInteger())
|
||||
self.field = fields.NonNegativeIntegerField()
|
||||
self.coerce_bad_values.extend(['-2', '4.2'])
|
||||
|
||||
|
||||
@ -247,7 +247,7 @@ class TestFloat(TestField):
|
||||
class TestNonNegativeFloat(TestFloat):
|
||||
def setUp(self):
|
||||
super(TestNonNegativeFloat, self).setUp()
|
||||
self.field = fields.Field(fields.NonNegativeFloat())
|
||||
self.field = fields.NonNegativeFloatField()
|
||||
self.coerce_bad_values.extend(['-4.2'])
|
||||
|
||||
|
||||
|
@ -51,7 +51,7 @@ oslo.service>=1.10.0 # Apache-2.0
|
||||
rfc3986>=0.2.2 # Apache-2.0
|
||||
oslo.middleware>=3.0.0 # Apache-2.0
|
||||
psutil<2.0.0,>=1.1.1 # BSD
|
||||
oslo.versionedobjects>=1.13.0 # Apache-2.0
|
||||
oslo.versionedobjects>=1.17.0 # Apache-2.0
|
||||
os-brick>=1.8.0 # Apache-2.0
|
||||
os-vif>=1.3.0 # Apache-2.0
|
||||
os-win>=1.1.0 # Apache-2.0
|
||||
|
Loading…
Reference in New Issue
Block a user