def _validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb): # Handle asType and asOsArches specially. if sAttr == 'sType': (oNewValue, sError) = ModelDataBase._validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb); if sError is None: if len(self.asTypes) <= 0: oNewValue = None; else: for sType in oNewValue: if len(sType) < 2 or sType.lower() != sType: if sError is None: sError = ''; else: sError += ', '; sError += 'invalid value "%s"' % (sType,); elif sAttr == 'asOsArches': (oNewValue, sError) = self.validateListOfStr(oValue, aoNilValues = aoNilValues, fAllowNull = fAllowNull, asValidValues = coreconsts.g_kasOsDotCpusAll); if sError is not None and oNewValue is not None: oNewValue = sorted(oNewValue); # Must be sorted! elif sAttr == 'cSecMaxAge' and oValue not in aoNilValues: # Allow human readable interval formats. (oNewValue, sError) = utils.parseIntervalSeconds(oValue); else: return ModelDataBase._validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb); return (oNewValue, sError);
def _validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb): # Handle asType and asOsArches specially. if sAttr == 'sType': (oNewValue, sError) = ModelDataBase._validateAndConvertAttribute( self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb) if sError is None: if len(self.asTypes) <= 0: oNewValue = None else: for sType in oNewValue: if len(sType) < 2 or sType.lower() != sType: if sError is None: sError = '' else: sError += ', ' sError += 'invalid value "%s"' % (sType, ) elif sAttr == 'asOsArches': (oNewValue, sError) = self.validateListOfStr( oValue, aoNilValues=aoNilValues, fAllowNull=fAllowNull, asValidValues=coreconsts.g_kasOsDotCpusAll) if sError is not None and oNewValue is not None: oNewValue = sorted(oNewValue) # Must be sorted! elif sAttr == 'cSecMaxAge' and oValue not in aoNilValues: # Allow human readable interval formats. (oNewValue, sError) = utils.parseIntervalSeconds(oValue) else: return ModelDataBase._validateAndConvertAttribute( self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb) return (oNewValue, sError)
def _validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb): # Handle sType and asOsArches specially. if sAttr == 'sType': (oNewValue, sError) = ModelDataBase._validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb); if sError is None and self.sType.lower() != self.sType: sError = 'Invalid build type value'; elif sAttr == 'asOsArches': (oNewValue, sError) = self.validateListOfStr(oValue, aoNilValues = aoNilValues, fAllowNull = fAllowNull, asValidValues = coreconsts.g_kasOsDotCpusAll); if sError is not None and oNewValue is not None: oNewValue = sorted(oNewValue); # Must be sorted! else: return ModelDataBase._validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb); return (oNewValue, sError);
def _validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb): if sAttr == 'cSecTimeout' and oValue not in aoNilValues: # Allow human readable interval formats. return utils.parseIntervalSeconds(oValue); (oValue, sError) = ModelDataBase._validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb); if sError is None: if sAttr == 'sTestBoxReqExpr': sError = TestCaseData.validateTestBoxReqExpr(oValue); elif sAttr == 'sBuildReqExpr': sError = TestCaseData.validateBuildReqExpr(oValue); return (oValue, sError);
def _validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb): # Custom handling of the email field. if sAttr == 'sEmail': return ModelDataBase.validateEmail(oValue, aoNilValues = aoNilValues, fAllowNull = fAllowNull); # Automatically lowercase the login name if we're supposed to do case # insensitive matching. (The feature assumes lower case in DB.) if sAttr == 'sLoginName' and oValue is not None and config.g_kfLoginNameCaseInsensitive: oValue = oValue.lower(); return ModelDataBase._validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb);
def _validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb): if sAttr != 'aidTestCaseArgs': return ModelDataBase._validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb); # -1 is a special value, which when present make the whole thing NULL (None). (aidVariations, sError) = self.validateListOfInts(oValue, aoNilValues = aoNilValues, fAllowNull = fAllowNull, iMin = -1, iMax = 0x7ffffffe); if sError is None: if aidVariations is None: pass; elif -1 in aidVariations: aidVariations = None; elif 0 in aidVariations: sError = 'Invalid test case varation ID #0.'; else: aidVariations = sorted(aidVariations); return (aidVariations, sError);