def ContentType(self, field, ContentType = None): if(ContentType == None): return self.ContentTypes[field]['ContentType'] else: if(ContentType not in self.__ValidContentTypes): raise SpecError("Cannot set Content type '{0}' for F{1}: Invalid content type".format(ContentType, field)) self.ContentTypes[field]['ContentType'] = ContentType
def LengthType(self, field, LengthType = None): if(LengthType == None): return self.ContentTypes[field]['LenType'] else: if(LengthType not in self.__ValidContentTypes): raise SpecError("Cannot set Length type '{0}' for F{1}: Invalid length type".format(LengthType, field)) self.ContentTypes[field]['LenType'] = LengthType
def LengthDataType(self, field, LengthDataType = None): if(LengthDataType == None): return self.DataTypes[field]['Length'] else: if(LengthDataType not in DT): raise SpecError("Cannot set data type '{0}' for F{1}: Invalid data type".format(LengthDataType, field)) if(field not in self.DataTypes.keys()): self.DataTypes[field] = {} self.DataTypes[field]['Length'] = LengthDataType
def DataType(self, field, DataType=None): if DataType == None: return self.DataTypes[field]['Data'] else: if DataType not in DT: raise SpecError( "Cannot set data type '{0}' for F{1}: Invalid data type". format(DataType, field)) if field not in self.DataTypes.keys(): self.DataTypes[field] = {} self.DataTypes[field]['Data'] = DataType