本文整理汇总了Python中testmanager.core.base.ModelDataBase._validateAndConvertAttribute方法的典型用法代码示例。如果您正苦于以下问题:Python ModelDataBase._validateAndConvertAttribute方法的具体用法?Python ModelDataBase._validateAndConvertAttribute怎么用?Python ModelDataBase._validateAndConvertAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类testmanager.core.base.ModelDataBase
的用法示例。
在下文中一共展示了ModelDataBase._validateAndConvertAttribute方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _validateAndConvertAttribute
# 需要导入模块: from testmanager.core.base import ModelDataBase [as 别名]
# 或者: from testmanager.core.base.ModelDataBase import _validateAndConvertAttribute [as 别名]
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: _validateAndConvertAttribute
# 需要导入模块: from testmanager.core.base import ModelDataBase [as 别名]
# 或者: from testmanager.core.base.ModelDataBase import _validateAndConvertAttribute [as 别名]
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);
示例3: _validateAndConvertAttribute
# 需要导入模块: from testmanager.core.base import ModelDataBase [as 别名]
# 或者: from testmanager.core.base.ModelDataBase import _validateAndConvertAttribute [as 别名]
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);
示例4: _validateAndConvertAttribute
# 需要导入模块: from testmanager.core.base import ModelDataBase [as 别名]
# 或者: from testmanager.core.base.ModelDataBase import _validateAndConvertAttribute [as 别名]
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);
示例5: _validateAndConvertAttribute
# 需要导入模块: from testmanager.core.base import ModelDataBase [as 别名]
# 或者: from testmanager.core.base.ModelDataBase import _validateAndConvertAttribute [as 别名]
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);