예제 #1
0
 def validate(self):
     '''Validate if not a reference property.'''
     if not is_function(self.value):
         if self.type == Schema.STRING:
             self.value = str(self.value)
         DataEntity.validate_datatype(self.type, self.value,
                                      self.entry_schema, self.custom_def)
         self._validate_constraints()
예제 #2
0
    def _validate_value(self, value):
        tosca = EntityType.TOSCA_DEF
        datatype = None
        if self.type in tosca:
            datatype = tosca[self.type]
        elif EntityType.DATATYPE_PREFIX + self.type in tosca:
            datatype = tosca[EntityType.DATATYPE_PREFIX + self.type]

        DataEntity.validate_datatype(self.type, value, None, datatype)