Changeset 61220 in vbox for trunk/src/VBox/ValidationKit/testmanager/core/buildsource.py
- Timestamp:
- May 27, 2016 1:16:02 AM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 107509
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testmanager/core/buildsource.py
r56295 r61220 35 35 # Validation Kit imports. 36 36 from common import utils; 37 from testmanager.core.base import ModelDataBase, ModelDataBaseTestCase, ModelLogicBase, TMExceptionBase; 37 from testmanager.core.base import ModelDataBase, ModelDataBaseTestCase, ModelLogicBase, TMRowAlreadyExists, \ 38 TMRowInUse, TMInvalidData, TMRowNotFound; 38 39 from testmanager.core import coreconsts; 39 40 … … 90 91 """ 91 92 if aoRow is None: 92 raise TM ExceptionBase('Build source not found.');93 raise TMRowNotFound('Build source not found.'); 93 94 94 95 self.idBuildSrc = aoRow[0]; … … 118 119 aoRow = oDb.fetchOne() 119 120 if aoRow is None: 120 raise TM ExceptionBase('idBuildSrc=%s not found (tsNow=%s sPeriodBack=%s)' % (idBuildSrc, tsNow, sPeriodBack,));121 raise TMRowNotFound('idBuildSrc=%s not found (tsNow=%s sPeriodBack=%s)' % (idBuildSrc, tsNow, sPeriodBack,)); 121 122 return self.initFromDbRow(aoRow); 122 123 … … 205 206 # Validate the input. 206 207 # 207 dErrors = oData.validateAndConvert(self._oDb );208 dErrors = oData.validateAndConvert(self._oDb, oData.ksValidateFor_Add); 208 209 if len(dErrors) > 0: 209 raise TM ExceptionBase('addEntry invalid input: %s' % (dErrors,));210 raise TMInvalidData('addEntry invalid input: %s' % (dErrors,)); 210 211 self._assertUnique(oData, None); 211 212 … … 247 248 # Validate the input and read the old entry. 248 249 # 249 dErrors = oData.validateAndConvert(self._oDb );250 dErrors = oData.validateAndConvert(self._oDb, oData.ksValidateFor_Edit); 250 251 if len(dErrors) > 0: 251 raise TM ExceptionBase('addEntry invalid input: %s' % (dErrors,));252 raise TMInvalidData('addEntry invalid input: %s' % (dErrors,)); 252 253 self._assertUnique(oData, oData.idBuildSrc); 253 254 oOldData = BuildSourceData().initFromDbWithId(self._oDb, oData.idBuildSrc); … … 303 304 for aoRow in self._oDb.fetchAll(): 304 305 asGroups.append('%s (#%d)' % (aoRow[1], aoRow[0])); 305 raise TM ExceptionBase('Build source #%d is used by one or more scheduling groups: %s'306 306 raise TMRowInUse('Build source #%d is used by one or more scheduling groups: %s' 307 % (idBuildSrc, ', '.join(asGroups),)); 307 308 else: 308 309 self._oDb.execute('UPDATE SchedGroups\n' … … 435 436 , ( oData.sName, )) 436 437 if self._oDb.getRowCount() > 0: 437 raise TM ExceptionBase('A build source with name "%s" already exist.' % (oData.sName,));438 raise TMRowAlreadyExists('A build source with name "%s" already exist.' % (oData.sName,)); 438 439 return True; 439 440
Note:
See TracChangeset
for help on using the changeset viewer.