Changeset 61220 in vbox for trunk/src/VBox/ValidationKit/testmanager/core/build.py
- Timestamp:
- May 27, 2016 1:16:02 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testmanager/core/build.py
r56295 r61220 37 37 from testmanager import config; 38 38 from testmanager.core import coreconsts; 39 from testmanager.core.base import ModelDataBase, ModelDataBaseTestCase, ModelLogicBase, TMExceptionBase; 39 from testmanager.core.base import ModelDataBase, ModelDataBaseTestCase, ModelLogicBase, TMExceptionBase, \ 40 TMTooManyRows, TMInvalidData, TMRowNotFound, TMRowInUse; 40 41 41 42 … … 76 77 """ 77 78 if aoRow is None: 78 raise TM ExceptionBase('BuildCategory not found.');79 raise TMRowNotFound('BuildCategory not found.'); 79 80 80 81 self.idBuildCategory = aoRow[0]; … … 94 95 aoRow = oDb.fetchOne() 95 96 if aoRow is None: 96 raise TM ExceptionBase('idBuildCategory=%s not found' % (idBuildCategory, ));97 raise TMRowNotFound('idBuildCategory=%s not found' % (idBuildCategory, )); 97 98 return self.initFromDbRow(aoRow); 98 99 … … 220 221 cBuilds = self._oDb.fetchOne()[0]; 221 222 if cBuilds > 0: 222 raise TM ExceptionBase('Build category #%d is used by %d builds and can therefore not be deleted.'223 223 raise TMRowInUse('Build category #%d is used by %d builds and can therefore not be deleted.' 224 % (idBuildCategory, cBuilds,)); 224 225 225 226 # … … 294 295 295 296 # Check BuildCategoryData before do anything 296 dDataErrors = oData.validateAndConvert(self._oDb );297 dDataErrors = oData.validateAndConvert(self._oDb, oData.ksValidateFor_Add); 297 298 if len(dDataErrors) > 0: 298 raise TM ExceptionBase('Invalid data passed to addBuildCategory(): %s' % (dDataErrors,));299 raise TMInvalidData('Invalid data passed to addBuildCategory(): %s' % (dDataErrors,)); 299 300 300 301 # Does it already exist? … … 363 364 """ 364 365 if aoRow is None: 365 raise TM ExceptionBase('Build not found.');366 raise TMRowNotFound('Build not found.'); 366 367 367 368 self.idBuild = aoRow[0]; … … 389 390 aoRow = oDb.fetchOne() 390 391 if aoRow is None: 391 raise TM ExceptionBase('idBuild=%s not found (tsNow=%s sPeriodBack=%s)' % (idBuild, tsNow, sPeriodBack,));392 raise TMRowNotFound('idBuild=%s not found (tsNow=%s sPeriodBack=%s)' % (idBuild, tsNow, sPeriodBack,)); 392 393 return self.initFromDbRow(aoRow); 393 394 … … 443 444 """ 444 445 if aoRow is None: 445 raise TM ExceptionBase('Build not found.');446 raise TMRowNotFound('Build not found.'); 446 447 BuildData.initFromDbRow(self, aoRow); 447 448 self.oCat = BuildCategoryData().initFromDbRow(aoRow[11:]); … … 461 462 aoRow = oDb.fetchOne() 462 463 if aoRow is None: 463 raise TM ExceptionBase('idBuild=%s not found (tsNow=%s sPeriodBack=%s)' % (idBuild, tsNow, sPeriodBack,));464 raise TMRowNotFound('idBuild=%s not found (tsNow=%s sPeriodBack=%s)' % (idBuild, tsNow, sPeriodBack,)); 464 465 return self.initFromDbRow(aoRow); 465 466 … … 556 557 # Validate input and get current data. 557 558 # 558 dErrors = oData.validateAndConvert(self._oDb );559 dErrors = oData.validateAndConvert(self._oDb, oData.ksValidateFor_Edit); 559 560 if len(dErrors) > 0: 560 raise TM ExceptionBase('editEntry invalid input: %s' % (dErrors,));561 raise TMInvalidData('editEntry invalid input: %s' % (dErrors,)); 561 562 oOldData = BuildData().initFromDbWithId(self._oDb, oData.idBuild); 562 563 … … 714 715 aRows = self._oDb.fetchAll() 715 716 if len(aRows) not in (0, 1): 716 raise TM ExceptionBase('Found more than one build with the same credentials. Database structure is corrupted.')717 raise TMTooManyRows('Found more than one build with the same credentials. Database structure is corrupted.') 717 718 try: 718 719 return BuildDataEx().initFromDbRow(aRows[0])
Note:
See TracChangeset
for help on using the changeset viewer.