本文整理汇总了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);
示例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;
示例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;
示例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;
示例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
示例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;
示例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;
示例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);
示例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;
示例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;
示例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)
示例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
示例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;
示例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
示例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