示例#1
0
    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);
示例#2
0
    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);
示例#3
0
 def initFromValues(self, sArgs, cSecTimeout = None, sTestBoxReqExpr = None, sBuildReqExpr = None,  # pylint: disable=R0913
                    cGangMembers = 1, idTestCase = None, idTestCaseArgs = None, tsEffective = None, tsExpire = None,
                    uidAuthor = None, idGenTestCaseArgs = None):
     """
     Reinitialize from values.
     Returns self.
     """
     self.idTestCase         = idTestCase;
     self.idTestCaseArgs     = idTestCaseArgs;
     self.tsEffective        = tsEffective;
     self.tsExpire           = tsExpire;
     self.uidAuthor          = uidAuthor;
     self.idGenTestCaseArgs  = idGenTestCaseArgs;
     self.sArgs              = sArgs;
     self.cSecTimeout        = utils.parseIntervalSeconds(cSecTimeout);
     self.sTestBoxReqExpr    = sTestBoxReqExpr;
     self.sBuildReqExpr      = sBuildReqExpr;
     self.cGangMembers       = cGangMembers;
     return self;