当前位置: 首页>>代码示例>>Python>>正文


Python base.ModelDataBase类代码示例

本文整理汇总了Python中testmanager.core.base.ModelDataBase的典型用法代码示例。如果您正苦于以下问题:Python ModelDataBase类的具体用法?Python ModelDataBase怎么用?Python ModelDataBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ModelDataBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _validateAndConvertAttribute

    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);
开发者ID:mcenirm,项目名称:vbox,代码行数:27,代码来源:buildsource.py

示例2: __init__

    def __init__(self):
        ModelDataBase.__init__(self);

        #
        # Initialize with defaults.
        # See the database for explanations of each of these fields.
        #
        self.idTestSet              = None;
        self.tsConfig               = None;
        self.tsCreated              = None;
        self.tsDone                 = None;
        self.enmStatus              = 'running';
        self.idBuild                = None;
        self.idBuildCategory        = None;
        self.idBuildTestSuite       = None;
        self.idGenTestBox           = None;
        self.idTestBox              = None;
        self.idSchedGroup           = None;
        self.idTestGroup            = None;
        self.idGenTestCase          = None;
        self.idTestCase             = None;
        self.idGenTestCaseArgs      = None;
        self.idTestCaseArgs         = None;
        self.idTestResult           = None;
        self.sBaseFilename          = None;
        self.iGangMemberNo          = 0;
        self.idTestSetGangLeader    = None;
开发者ID:svn2github,项目名称:virtualbox,代码行数:27,代码来源:testset.py

示例3: getEffectiveDateParam

    def getEffectiveDateParam(self, sParamName = None):
        """
        Gets the effective date parameter.

        Returns a timestamp suitable for database and url parameters.
        Returns None if not found or empty.

        The first call with sParamName set to None will set the internal _tsNow
        value upon successfull return.
        """

        sName = sParamName if sParamName is not None else WuiDispatcherBase.ksParamEffectiveDate

        if sName not in self._dParams:
            return None;

        if sName not in self._asCheckedParams:
            self._asCheckedParams.append(sName);

        sValue = self._dParams[sName];
        if isinstance(sValue, list):
            raise WuiException('%s parameter "%s" is given multiple times: %s' % (self._sAction, sName, sValue));
        sValue = sValue.strip();
        if sValue == '':
            return None;

        #
        # Timestamp, just validate it and return.
        #
        if sValue[0] not in ['-', '+']:
            (sValue, sError) = ModelDataBase.validateTs(sValue);
            if sError is not None:
                raise WuiException('%s parameter "%s" ("%s") is invalid: %s' % (self._sAction, sName, sValue, sError));
            if sParamName is None and self._tsNow is None:
                self._tsNow = sValue;
            return sValue;

        #
        # Relative timestamp. Validate and convert it to a fixed timestamp.
        #
        chSign = sValue[0];
        (sValue, sError) = ModelDataBase.validateTs(sValue[1:]);
        if sError is not None:
            raise WuiException('%s parameter "%s" ("%s") is invalid: %s' % (self._sAction, sName, sValue, sError));
        if sValue[-6] in ['-', '+']:
            raise WuiException('%s parameter "%s" ("%s") is a relative timestamp but incorrectly includes a time zone.'
                               % (self._sAction, sName, sValue));
        offTime = 11;
        if sValue[offTime - 1] != ' ':
            raise WuiException('%s parameter "%s" ("%s") incorrect format.' % (self._sAction, sName, sValue));
        sInterval = 'P' + sValue[:(offTime - 1)] + 'T' + sValue[offTime:];

        self._oDb.execute('SELECT CURRENT_TIMESTAMP ' + chSign + ' \'' + sInterval + '\'::INTERVAL');
        oDate = self._oDb.fetchOne()[0];

        sValue = str(oDate);
        if sParamName is None and self._tsNow is None:
            self._tsNow = sValue;
        return sValue;
开发者ID:svn2github,项目名称:virtualbox,代码行数:59,代码来源:wuibase.py

示例4: __init__

 def __init__(self):
     ModelDataBase.__init__(self);
     self.idTestBox          = None;
     self.idSchedGroup       = None;
     self.tsEffective        = None;
     self.tsExpire           = None;
     self.uidAuthor          = None;
     self.iSchedPriority     = 16;
开发者ID:miguelinux,项目名称:vbox,代码行数:8,代码来源:testbox.py

示例5: __init__

 def __init__(self):
     ModelDataBase.__init__(self)
     self.idTestResult = None
     self.tsEffective = None
     self.tsExpire = None
     self.uidAuthor = None
     self.idTestSet = None
     self.idFailureReason = None
     self.sComment = None
开发者ID:miguelinux,项目名称:vbox,代码行数:9,代码来源:testresultfailures.py

示例6: __init__

    def __init__(self):
        ModelDataBase.__init__(self);

        #
        # Initialize with defaults.
        # See the database for explanations of each of these fields.
        #
        self.tsCreated          = None;
        self.sEvent             = None;
        self.sLogText           = None;
开发者ID:mdaniel,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:10,代码来源:systemlog.py

示例7: __init__

 def __init__(self):
     """Init parameters"""
     ModelDataBase.__init__(self);
     self.uid            = None;
     self.tsEffective    = None;
     self.tsExpire       = None;
     self.uidAuthor      = None;
     self.sUsername      = None;
     self.sEmail         = None;
     self.sFullName      = None;
     self.sLoginName     = None;
开发者ID:sobomax,项目名称:virtualbox_64bit_edd,代码行数:11,代码来源:useraccount.py

示例8: _validateAndConvertAttribute

    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);
开发者ID:mdaniel,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:11,代码来源:useraccount.py

示例9: __init__

    def __init__(self):
        ModelDataBase.__init__(self);

        #
        # Initialize with defaults.
        # See the database for explanations of each of these fields.
        #
        self.idTestBox           = None;
        self.idGenTestBox        = None;
        self.tsUpdated           = None;
        self.enmState            = self.ksTestBoxState_Idle;
        self.idTestSet           = None;
开发者ID:mcenirm,项目名称:vbox,代码行数:12,代码来源:testboxstatus.py

示例10: __init__

    def __init__(self):
        ModelDataBase.__init__(self);

        #
        # Initialize with defaults.
        # See the database for explanations of each of these fields.
        #
        self.sRepository        = None;
        self.iRevision          = None;
        self.tsCreated          = None;
        self.sAuthor            = None;
        self.sMessage           = None;
开发者ID:swimming198243,项目名称:virtualbox,代码行数:12,代码来源:vcsrevisions.py

示例11: getEffectiveDateParam

    def getEffectiveDateParam(self, sParamName=None):
        """
        Gets the effective date parameter.
        Returns a timestamp suitable for database and url parameters.
        Returns None if not found or empty.
        """

        sName = sParamName if sParamName is not None else WuiDispatcherBase.ksParamEffectiveDate

        if sName not in self._dParams:
            return None

        if sName not in self._asCheckedParams:
            self._asCheckedParams.append(sName)

        sValue = self._dParams[sName]
        if isinstance(sValue, list):
            raise WuiException('%s parameter "%s" is given multiple times: %s' % (self._sAction, sName, sValue))
        sValue = sValue.strip()
        if sValue == "":
            return None

        #
        # Timestamp, just validate it and return.
        #
        if sValue[0] not in ["-", "+"]:
            (sValue, sError) = ModelDataBase.validateTs(sValue)
            if sError is not None:
                raise WuiException('%s parameter "%s" ("%s") is invalid: %s' % (self._sAction, sName, sValue, sError))
            return sValue

        #
        # Relative timestamp. Validate and convert it to a fixed timestamp.
        #
        chSign = sValue[0]
        (sValue, sError) = ModelDataBase.validateTs(sValue[1:])
        if sError is not None:
            raise WuiException('%s parameter "%s" ("%s") is invalid: %s' % (self._sAction, sName, sValue, sError))
        if sValue[-6] in ["-", "+"]:
            raise WuiException(
                '%s parameter "%s" ("%s") is a relative timestamp but incorrectly includes a time zone.'
                % (self._sAction, sName, sValue)
            )
        offTime = 11
        if sValue[offTime - 1] != " ":
            raise WuiException('%s parameter "%s" ("%s") incorrect format.' % (self._sAction, sName, sValue))
        sInterval = "P" + sValue[: (offTime - 1)] + "T" + sValue[offTime:]

        self._oDb.execute("SELECT CURRENT_TIMESTAMP " + chSign + " '" + sInterval + "'::INTERVAL")
        oDate = self._oDb.fetchOne()[0]

        return str(oDate)
开发者ID:swimming198243,项目名称:virtualbox,代码行数:52,代码来源:wuibase.py

示例12: __init__

    def __init__(self):
        ModelDataBase.__init__(self);

        #
        # Initialize with defaults.
        # See the database for explanations of each of these fields.
        #
        self.idTestGroup     = None
        self.tsEffective     = None
        self.tsExpire        = None
        self.uidAuthor       = None
        self.sName           = None
        self.sDescription    = None
开发者ID:sobomax,项目名称:virtualbox_64bit_edd,代码行数:13,代码来源:testgroup.py

示例13: __init__

    def __init__(self):
        ModelDataBase.__init__(self);

        #
        # Initialize with defaults.
        # See the database for explanations of each of these fields.
        #
        self.idBuildCategory    = None;
        self.sProduct           = None;
        self.sRepository        = None;
        self.sBranch            = None;
        self.sType              = None;
        self.asOsArches         = None;
开发者ID:mdaniel,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:13,代码来源:build.py

示例14: __init__

    def __init__(self):
        ModelDataBase.__init__(self);

        #
        # Initialize with defaults.
        # See the database for explanations of each of these fields.
        #
        self.idGlobalRsrc       = None;
        self.tsEffective        = None;
        self.tsExpire           = None;
        self.uidAuthor          = None;
        self.sName              = None;
        self.sDescription       = None;
        self.fEnabled           = False
开发者ID:mcenirm,项目名称:vbox,代码行数:14,代码来源:globalresource.py

示例15: __init__

    def __init__(self):
        ModelDataBase.__init__(self);

        #
        # Initialize with defaults.
        # See the database for explanations of each of these fields.
        #

        self.idFailureCategory = None
        self.tsEffective       = None
        self.tsExpire          = None
        self.uidAuthor         = None
        self.sShort            = None
        self.sFull             = None
开发者ID:mdaniel,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:14,代码来源:failurecategory.py


注:本文中的testmanager.core.base.ModelDataBase类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。