def __init__(self,name,context,configRoot): self.name = name self.context = context self.loaderFile = os.path.join(configRoot,"external loaders", name, "profiles", context,"%s.xml"%(context)) xmldoc = xml.dom.minidom.parse(self.loaderFile) commandConfigTag = xmldoc.getElementsByTagName("commandConfig") if len(commandConfigTag) >0: commandConfigTag = commandConfigTag[0] self.commandName=cs.grabAttribute(commandConfigTag,"commandName") self.currentWorkingDirectory=cs.grabAttribute(commandConfigTag,"currentWorkingDirectory") self.args=[] argumentsTag = commandConfigTag.getElementsByTagName("arguments") if len(argumentsTag) >0: argumentsTag = argumentsTag[0] argTags = argumentsTag.getElementsByTagName("arg") if len(argTags) >0: for thisArg in argTags: arg = Arg(thisArg) self.args.append(arg)
def __init__(self, settings, format=None): self.specification = settings.specification self.specificationName = self.specification.name if format is None: self.format = settings.args.format else: self.format = format self.extractXmlFilename = os.path.join(settings.paths["repository"],"specifications", self.specificationName, "extract_formats", "extract_{0}.xml".format(self.format)) xmldoc = xml.dom.minidom.parse(self.extractXmlFilename) extractTag = xmldoc.getElementsByTagName("extract")[0] self.constants = {} constantsTag = extractTag.getElementsByTagName("constants") if constantsTag is not None: constantsTag = constantsTag[0] constantTags = xmldoc.getElementsByTagName("constant") for constantTag in constantTags: name = cs.grabAttribute(constantTag , "name") value = cs.grabAttribute(constantTag , "value") self.constants[name]=value csvExtractorTag = extractTag.getElementsByTagName("csvExtractor") if len(csvExtractorTag)==1: self.extractor = CsvExtractor(csvExtractorTag[0]) xmldoc.unlink()
def __init__(self, capabilityInputsTag): self.capabilityName = cs.grabAttribute(capabilityInputsTag, "capability") self.delimiter = cs.grabAttribute(capabilityInputsTag, "delimiter") self.format = cs.grabAttribute(capabilityInputsTag, "format") self.inputs = [] inputTags = capabilityInputsTag.getElementsByTagName("input") for inputTag in inputTags: self.inputs.append(self.Input(inputTag))
def __init__(self, argTag): self.value=cs.grabAttribute(argTag,"value") self.placeholders=[] placeholderContentTag = argTag.getElementsByTagName("placeholderContent") if len(placeholderContentTag) >0: placeholderContentTag=placeholderContentTag[0] placeholderTags = placeholderContentTag.getElementsByTagName("placeholder") for thisPlaceholder in placeholderTags: value = cs.grabAttribute(thisPlaceholder,"variable") self.placeholders.append(value)
def __init__(self, timestampColumnTag): self.type = "timestampColumn" self.taskOrder = 2 self.outputColumn = cs.grabAttribute(timestampColumnTag,"outputColumn") self.triggeringColumns=[] triggeringColumnsTag = timestampColumnTag.getElementsByTagName("triggeringColumns") if len(triggeringColumnsTag)>0: for column in triggeringColumnsTag[0].getElementsByTagName("column"): columnName = cs.grabAttribute(column, "name") self.triggeringColumns.append(columnName)
def __init__(self,name, profile, configRoot): self.name = name self.profile = profile # Grab registry settings self.configFile = os.path.join(configRoot,"external_loaders", name, "loader_config.xml") xmldoc = xml.dom.minidom.parse(self.configFile) loaderConfigTag = xmldoc.getElementsByTagName("loaderConfig")[0] registerTag = loaderConfigTag.getElementsByTagName("registry")[0] self.registry={} keyTags = registerTag.getElementsByTagName("key") for keyTag in keyTags: keyName = cs.grabAttribute(keyTag,"name") keyValue =cs.grabAttribute(keyTag,"value") self.registry[keyName]=keyValue xmldoc.unlink() self.commandName=self.registry["commandName"] self.currentWorkingDirectory=self.registry["currentWorkingDirectory"] #Grab profile file self.profileFile = os.path.join(configRoot,"external_loaders", name, "profiles", "{0}.xml".format(profile)) xmldoc = xml.dom.minidom.parse(self.profileFile) externalLoaderProfileTag = xmldoc.getElementsByTagName("externalLoaderProfile") if len(externalLoaderProfileTag) >0: externalLoaderProfileTag = externalLoaderProfileTag[0] profileCommandName=cs.grabAttribute(externalLoaderProfileTag,"commandName") if profileCommandName is not None: self.commandName = profileCommandName profileCurrentWorkingDirectory=cs.grabAttribute(externalLoaderProfileTag,"currentWorkingDirectory") if profileCurrentWorkingDirectory is not None: self.currentWorkingDirectory=profileCurrentWorkingDirectory self.args=[] argumentsTag = externalLoaderProfileTag.getElementsByTagName("arguments") if len(argumentsTag) >0: argumentsTag = argumentsTag[0] argTags = argumentsTag.getElementsByTagName("arg") if len(argTags) >0: for thisArg in argTags: arg = Arg(thisArg) self.args.append(arg)
def __init__(self, tag): self.schema = cs.grabAttribute(tag, "schema") self.name = cs.grabAttribute(tag, "name") self.timestampColumn = cs.grabAttribute(tag, "timestampColumn") self.alias = cs.grabAttribute(tag, "alias") keyTag = tag.getElementsByTagName("key") if len(keyTag)==1: keyTag = keyTag[0] columnTags = keyTag.getElementsByTagName("column") self.keyColumns = list(map(lambda c:cs.grabAttribute(c, "name"), columnTags)) else: self.keyColumns = []
def __init__(self, zoneColumnTag): self.type = "zoneColumn" self.taskOrder = 2 self.outputColumn = cs.grabAttribute(zoneColumnTag,"outputColumn") if self.outputColumn is None: self.outputColumn = "zone" self.xColumn = cs.grabAttribute(zoneColumnTag,"xColumn") self.yColumn = cs.grabAttribute(zoneColumnTag,"yColumn") self.triggeringColumns = [self.xColumn, self.yColumn]
def getProfileSettings(profile): profileSettings = {} filename = "rename_{0}.xml".format(profile) fullPath = os.path.join(settings.paths["config"], "tools", "rename", "profiles", profile, filename) xmldoc = xml.dom.minidom.parse(fullPath) settingsTag = xmldoc.getElementsByTagName("settings")[0] keyTags = settingsTag.getElementsByTagName("key") for key in keyTags: name = cs.grabAttribute(key, "name") value = cs.grabAttribute(key, "value") profileSettings[name] = value return(profileSettings)
def __init__(self, tag): self.name = cs.grabAttribute(tag, "name") self.sourceType = cs.grabAttribute(tag, "sourceType") self.sourceValue = cs.grabAttribute(tag, "sourceValue") self.outputType = cs.grabAttribute(tag, "outputType") self.outputDecimalPlaces = cs.grabAttribute(tag, "outputDecimalPlaces") self.optionSetName = cs.grabAttribute(tag, "optionSetName") self.optionSetColumn = cs.grabAttribute(tag, "optionSetColumn") self.size = cs.grabAttribute(tag, "size") self.valueIfUnmapped = cs.grabAttribute(tag, "valueIfUnmapped")
def __init__(self, mappedColumnTag): self.type = "mappedColumn" self.taskOrder = 3 self.outputColumn = cs.grabAttribute(mappedColumnTag,"outputColumn") self.field = chimpspec.SpecificationRecordField(mappedColumnTag, None) self.inputColumn = cs.grabAttribute(mappedColumnTag,"inputColumn") self.optionSetName = cs.grabAttribute(mappedColumnTag,"optionSetName") self.optionSetColumn = cs.grabAttribute(mappedColumnTag,"optionSetColumn") if self.optionSetColumn is None: self.optionSetColumn = "label" self.valueIfUnmapped = cs.grabAttribute(mappedColumnTag,"valueIfUnmapped") self.triggeringColumns = [self.inputColumn]
def __init__(self, settings): filename = os.path.join(settings.paths["config"], "solr", "solr-settings.xml") xmldoc = xml.dom.minidom.parse(filename) solrSettingsTag = xmldoc.getElementsByTagName("solrSettings")[0] registryTag = solrSettingsTag.getElementsByTagName("registry")[0] self.registry = {} keys = registryTag.getElementsByTagName("key") for key in keys: name = cs.grabAttribute(key, "name") value = cs.grabAttribute(key, "value") self.registry[name]=value xmldoc.unlink()
def __init__(self, ctreeTag): self.type = "ctree" self.taskOrder = 10 self.inputAncestorColumn = cs.grabAttribute(ctreeTag, "inputAncestorColumn") self.inputDescendantColumn = cs.grabAttribute(ctreeTag, "inputDescendantColumn") self.columnSuffix = cs.grabAttribute(ctreeTag, "columnSuffix") self.outputDepthColumn = cs.grabAttribute(ctreeTag, "outputDepthColumn") if self.outputDepthColumn is None: self.outputDepthColumn = "depth" self.outputImmediateAncestorColumn = cs.grabAttribute(ctreeTag, "outputImmediateAncestorColumn") if self.outputImmediateAncestorColumn is None: self.outputImmediateAncestorColumn = "immediate_ancestor" self.outputRootAncestorColumn = cs.grabAttribute(ctreeTag, "outputRootAncestorColumn") if self.outputRootAncestorColumn is None: self.outputRootAncestorColumn = "root_ancestor" self.outputDescendantCountColumn = cs.grabAttribute(ctreeTag, "outputDescendantCountColumn") if self.outputDescendantCountColumn is None: self.outputDescendantCountColumn = "descendant_count_column" self.ancestorColumnName = "ancestor_{0}".format(self.columnSuffix) self.descendantColumnName = "descendant_{0}".format(self.columnSuffix) self.dataType = "bigint" self.triggeringColumns = []
def __init__(self, capabilityTag): self.name = cs.grabAttribute(capabilityTag, "name") self.inputs = [] self.delimiter = None self.format = None assemblerFunctionName="{0}Assembler".format(self.name) assemblers = SolrAssemblers() if not hasattr(assemblers, assemblerFunctionName): assemblerFunctionName = "defaultAssembler" self.assemblerFunction = getattr(assemblers, assemblerFunctionName)
def __init__(self, columnDataType, optionTag, additionalAttributes): stringValue = str(cs.grabAttribute(optionTag,"value")) self.value = turnNative(columnDataType,stringValue) self.label=str(cs.grabAttribute(optionTag,"label")) self.attribData = [] additionalTag = optionTag.getElementsByTagName("additional") if len(additionalTag)>0: additionalTag = additionalTag[0] attribTags = additionalTag.getElementsByTagName("attrib") i =0 for attrib in attribTags: columnDataType = additionalAttributes[i].columnDataType value = str(cs.grabAttribute(attrib,"value")) if value !="": value = turnNative(columnDataType, value) else: value = None self.attribData.append(value) i += 1
def __init__(self, contentAssemblerTag): self.contentElements = [] if len(contentAssemblerTag) > 0: contentAssemblerTag = contentAssemblerTag [0] self.header = cs.grabAttribute(contentAssemblerTag, "header") self.delimiter = cs.grabAttribute(contentAssemblerTag, "delimiter") self.footer = cs.grabAttribute(contentAssemblerTag, "footer") self.format = cs.grabAttribute(contentAssemblerTag, "format") contentTag = contentAssemblerTag.getElementsByTagName("content") if len(contentTag) >0: contentTag = contentTag [0] for element in contentTag.getElementsByTagName("contentElement"): self.contentElements.append(ContentElement(element)) else: self.header = None self.footer = None
def getSettingValuesFromXmlFile(filename): env = {} visibilityLevels = {} securityLevels = {} xmldoc = xml.dom.minidom.parse(filename) settingsTag = xmldoc.getElementsByTagName("settings")[0] registryTag = settingsTag.getElementsByTagName("registry")[0] keyTags = registryTag.getElementsByTagName("key") for key in keyTags: name = cs.grabAttribute(key, "name") value = cs.grabAttribute(key, "value") env[name] = value visibilityLevelsTag = settingsTag.getElementsByTagName("visibilityLevels")[0] levelTags = visibilityLevelsTag.getElementsByTagName("level") for level in levelTags: name = cs.grabAttribute(level, "name") value = int(cs.grabAttribute(level, "value")) visibilityLevels[name] = value securityLevelsTag = settingsTag.getElementsByTagName("securityLevels")[0] levelTags = securityLevelsTag.getElementsByTagName("level") for level in levelTags: name = cs.grabAttribute(level, "name") value = int(cs.grabAttribute(level, "value")) securityLevels[name] = value zones=[] zoneTag = settingsTag.getElementsByTagName("zones")[0] zonesTags = zoneTag.getElementsByTagName("zone") for zone in zonesTags: zones.append(self.Zone(zone)) return(env, visibilityLevels, securityLevels, zones)
def __init__(self, settings, serverName, solrFields): self.name = serverName # Parse XML filename = os.path.join(settings.paths["repository"], "solr_servers", serverName, "solr_server.xml") xmldoc = xml.dom.minidom.parse(filename) solrServerTag = xmldoc.getElementsByTagName("solrServer")[0] solrTag = solrServerTag.getElementsByTagName("solr")[0] self.version = cs.grabAttribute(solrTag, "version") self.solrServerUrl = cs.grabAttribute(solrTag, "url") self.profile = cs.grabAttribute(solrTag, "profile") self.connectionName = cs.grabAttribute(solrTag, "connection") # Grab capabilities self.capabilities = [] capabilitiesTag = solrServerTag.getElementsByTagName("capabilities")[0] capabilityTags = capabilitiesTag.getElementsByTagName("capability") for capabilityTag in capabilityTags: self.capabilities.append(SolrCapability(capabilityTag)) # Build a field list self.fields = [] for solrField in solrFields.fields: if solrField.capability is None or (solrField.capability is not None and solrField.capability in(self.getCapabilityNames())): self.fields.append(self.ServerField(self.name, solrField)) xmldoc.unlink() filename = os.path.join(settings.paths["config"], "connections", "{0}.xml".format(self.connectionName)) xmldoc = xml.dom.minidom.parse(filename) connectionTag = xmldoc.getElementsByTagName("connection")[0] self.dbHost = cs.grabAttribute(connectionTag, "host") self.dbName = cs.grabAttribute(connectionTag, "dbname") self.dbUser = cs.grabAttribute(connectionTag, "user") self.dbPassword = cs.grabAttribute(connectionTag, "password") self.dbPort = cs.grabAttribute(connectionTag, "port") xmldoc.unlink()
def __init__(self, solrDocumentTag, solrSettings, solrFields, settings): self.type = "solrDocument" self.taskOrder = 100 self.name = cs.grabAttribute(solrDocumentTag, "documentName") self.solrServerName = cs.grabAttribute(solrDocumentTag, "solrServerName") self.solrServer = solr.SolrServer(settings, self.solrServerName, solrFields) self.triggeringColumns = [] documentContentTag = solrDocumentTag.getElementsByTagName("documentContent") if documentContentTag is not None: documentContentTag = documentContentTag [0] capabilityInputsTags = documentContentTag.getElementsByTagName("capabilityInputs") for capabilityInputsTag in capabilityInputsTags: capabilityInputs = CapabilityInputs(capabilityInputsTag) self.solrServer.setCapabilityInputs(capabilityInputs) keyCapability = self.solrServer.getCapabilityByName("documentKey") self.keyColumns = keyCapability.getColumns()
def __init__(self, customColumnTag): self.type = "customColumn" self.taskOrder = 1 self.outputColumn = cs.grabAttribute(customColumnTag,"outputColumn") self.field = chimpspec.SpecificationRecordField(customColumnTag, None) assembler = customColumnTag.getElementsByTagName("contentAssembler") if len(assembler)>0: self.contentAssembler = ContentAssembler(assembler[0]) else: self.contentAssembler = None self.triggeringColumns=[] triggeringColumnsTag = customColumnTag.getElementsByTagName("triggeringColumns") if len(triggeringColumnsTag)>0: for column in triggeringColumnsTag[0].getElementsByTagName("column"): columnName = cs.grabAttribute(column, "name") self.triggeringColumns.append(columnName) templateAssemblerTag = customColumnTag.getElementsByTagName("templateAssembler") self.templateAssembler = ContentAssembler(templateAssemblerTag)
def __init__(self, optionSetTag): self.name=cs.grabAttribute(optionSetTag,"name") self.type=cs.grabAttribute(optionSetTag,"type") self.size=cs.grabAttribute(optionSetTag,"size") if self.size is not None: self.size=int(self.size) self.decimalPlaces=cs.grabAttribute(optionSetTag,"decimalPlaces") if self.decimalPlaces is not None: self.decimalPlaces = int(self.decimalPlaces) self.field = chimpspec.SpecificationRecordField(None, None, column="value", type=self.type, mandatory=True, size=self.size, decimalPlaces=self.decimalPlaces) self.additionalAttributes = [] additionalAttributesTag = optionSetTag.getElementsByTagName("additionalAttributes") if len(additionalAttributesTag)>0: additionalAttributesTag = additionalAttributesTag[0] attributeTags = additionalAttributesTag.getElementsByTagName("attribute") for attribute in attributeTags: attributeName=cs.grabAttribute(attribute,"name") attributeType=cs.grabAttribute(attribute,"type") attributeSize=cs.grabAttribute(attribute,"size") attributeDecimalPlaces=cs.grabAttribute(attribute,"decimalPlaces") if attributeSize is not None: attributeSize=int(attributeSize) attributeDecimalPlaces=cs.grabAttribute(attribute,"decimalPlaces") if attributeDecimalPlaces is not None: attributeDecimalPlaces = int(attributeDecimalPlaces) self.additionalAttributes.append(chimpspec.SpecificationRecordField(None, None, column=attributeName, type=attributeType, mandatory=False, size=attributeSize, decimalPlaces=attributeDecimalPlaces)) allOptions = optionSetTag.getElementsByTagName("option") self.options={} for optionTag in allOptions: newOption=Option(self.field.columnDataType, optionTag, self.additionalAttributes) self.options[newOption.value] = newOption
def __init__(self, tag): self.name = cs.grabAttribute(tag , "name") sourceTag = tag.getElementsByTagName("source") self.lines=[] if len(sourceTag) ==1: sourceTag = sourceTag[0] self.fullSource = Source(sourceTag.getElementsByTagName("fullPrimaryKeys")) self.changeSource = Source(sourceTag.getElementsByTagName("changePrimaryKeys")) self.deleteSource = Source(sourceTag.getElementsByTagName("deletePrimaryKeys")) lineTags = tag.getElementsByTagName("line") for line in lineTags: self.lines.append(Line(line)) else: self.fullSource = Source(None) self.changeSource = Source(None) self.deleteSource = Source(None)
def __init__(self, inputTag): self.column = cs.grabAttribute(inputTag, "column") self.optionSetName = cs.grabAttribute(inputTag, "optionSetName") self.optionSetColumn = cs.grabAttribute(inputTag, "optionSetColumn") self.constant = cs.grabAttribute(inputTag, "constant") self.formattingFunctions = [] self.formattingMethods = [] formattingTag = inputTag.getElementsByTagName("formatting") if len(formattingTag) >0: formattingTag = formattingTag[0] functionTags = formattingTag.getElementsByTagName("function") for functionTag in functionTags: self.formattingFunctions.append(cs.grabAttribute(functionTag, "name")) methodTags = formattingTag.getElementsByTagName("method") for methodTag in methodTags: self.formattingMethods.append(cs.grabAttribute(methodTag, "name"))
def __init__(self, zoneTag): self.id = cs.grabAttribute(zoneTag, "id") self.schema = cs.grabAttribute(zoneTag, "schema") self.table = cs.grabAttribute(zoneTag, "table") self.column = cs.grabAttribute(zoneTag, "column")
def __init__(self, tag): self.type = "csvExtractor" destinationTag = tag.getElementsByTagName("destination") if destinationTag is not None: destinationTag = destinationTag[0] self.encoding = cs.grabAttribute(destinationTag , "encoding") self.defaultTargetDirectory = cs.grabAttribute(destinationTag, "defaultTargetDirectory") filenameTag = destinationTag.getElementsByTagName("filename") if filenameTag is not None: filenameTag = filenameTag[0] self.filenameFormat = cs.grabAttribute(filenameTag , "format") self.filenameInputVariables = [] inputTags = filenameTag.getElementsByTagName("input") for input in inputTags: self.filenameInputVariables.append(cs.grabAttribute(input , "variable")) formattingTag = tag.getElementsByTagName("formatting") if formattingTag is not None: formattingTag = formattingTag[0] self.delimiter = cs.grabAttribute(formattingTag , "delimiter") self.qualifier = cs.grabAttribute(formattingTag , "qualifier") self.dateFormat = cs.grabAttribute(formattingTag , "dateFormat") self.timeFormat = cs.grabAttribute(formattingTag , "timeFormat") self.dateTimeFormat = cs.grabAttribute(formattingTag , "dateTimeFormat") self.dateTimeFormat = cs.grabAttribute(formattingTag , "dateTimeFormat") self.qualifiedDates = cs.grabAttribute(formattingTag , "qualifiedDates") if self.qualifiedDates is not None: if self.qualifiedDates.lower()=="true": self.qualifiedDates = True else: self.qualifiedDates = False else: self.qualifiedDates = False self.qualifiedDateTimes = cs.grabAttribute(formattingTag , "qualifiedDateTimes") if self.qualifiedDateTimes is not None: if self.qualifiedDateTimes.lower()=="true": self.qualifiedDateTimes = True else: self.qualifiedDateTimes = False else: self.qualifiedDateTimes = False self.qualifiedTimes = cs.grabAttribute(formattingTag , "qualifiedTimes") if self.qualifiedTimes is not None: if self.qualifiedTimes.lower()=="true": self.qualifiedTimes = True else: self.qualifiedTimes = False else: self.qualifiedTimes = False self.sections=[] sectionsTag = tag.getElementsByTagName("sections") if sectionsTag is not None: sectionsTag = sectionsTag[0] sectionTags = sectionsTag.getElementsByTagName("section") for sectionTag in sectionTags: self.sections.append(Section(sectionTag))
def __init__(self, searchEntryTag): self.type = "searchEntry" self.taskOrder = 60 self.domain= cs.grabAttribute(searchEntryTag,"domain") self.ranking= cs.grabAttribute(searchEntryTag,"ranking")
def __init__(self, pinTag, settings): self.type = "pin" self.taskOrder = 50 self.triggeringColumns = [] self.name= cs.grabAttribute(pinTag,"name") self.title= cs.grabAttribute(pinTag,"title") self.description= cs.grabAttribute(pinTag,"description") self.xColumn = cs.grabAttribute(pinTag,"xColumn") self.yColumn = cs.grabAttribute(pinTag,"yColumn") self.whereClause = cs.grabAttribute(pinTag,"whereClause") self.idColumn = cs.grabAttribute(pinTag,"idColumn") self.keyColumn = cs.grabAttribute(pinTag,"keyColumn") self.documentType = cs.grabAttribute(pinTag,"documentType") self.vicinityResultIconColumn = cs.grabAttribute(pinTag,"vicinityResultIconColumn") self.vicinityResultIconConstant = cs.grabAttribute(pinTag,"vicinityResultIconConstant") self.vicinityResultLabelColumn = cs.grabAttribute(pinTag,"vicinityResultLabelColumn") if self.idColumn is None: self.idColumn = "id" self.minimumVisibility = cs.grabAttribute(pinTag,"minimumVisibility") self.maximumSecurity = cs.grabAttribute(pinTag,"maximumSecurity") computedDataTag = pinTag.getElementsByTagName("computedData") self.computedData = calc.CalculatedData("??", computedDataTag, settings) self.additionalIndexes=[] additionalIndexesTag = pinTag.getElementsByTagName("additionalIndexes") if additionalIndexesTag.length > 0: additionalIndexesTag = additionalIndexesTag[0] indexesTag = additionalIndexesTag.getElementsByTagName("index") for thisIndex in indexesTag: self.additionalIndexes.append(chimpspec.AdditionalIndex(thisIndex))
def __init__(self, fieldTag, order): self.name = cs.grabAttribute(fieldTag, "name") self.order = order self.solrType = cs.grabAttribute(fieldTag, "solrType") self.indexed = cs.grabAttribute(fieldTag, "indexed") if self.indexed in("true","True"): self.indexed = True else: self.indexed = False self.stored = cs.grabAttribute(fieldTag, "stored") if self.stored in("true","True"): self.stored = True else: self.stored = False self.capability = cs.grabAttribute(fieldTag, "capability") self.chimpType = cs.grabAttribute(fieldTag, "chimpType") self.size = cs.grabAttribute(fieldTag, "size") if self.size is not None: self.size = int(self.size) self.decimalPlaces = cs.grabAttribute(fieldTag, "decimalPlaces") self.decimalPlaces = cs.grabAttribute(fieldTag, "decimalPlaces") if self.decimalPlaces is not None: self.decimalPlaces = int(self.decimalPlaces) self.mandatory = cs.grabAttribute(fieldTag, "mandatory") if self.mandatory is None: self.mandatory = False else: if self.mandatory in("True","true","TRUE"): self.mandatory = True elif self.mandatory in("False","false","FALSE"): self.mandatory = False self.variable = cs.grabAttribute(fieldTag, "variable")
def __init__(self, contentElementTag): self.prefix = cs.grabAttribute(contentElementTag,"prefix") self.column = cs.grabAttribute(contentElementTag,"column") self.suffix = cs.grabAttribute(contentElementTag,"suffix")