Changeset 16012 for main/waeup.kofa/trunk/src/waeup/kofa/utils
- Timestamp:
- 24 Feb 2020, 21:26:35 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/utils/batching.py
r15065 r16012 196 196 raise NotImplementedError('method not implemented') 197 197 198 def checkCreateRequirements(self, parent, row, site): 199 """Checks requirements the parent object must fulfill when 200 a new subobject is being created. 201 202 This method is not used in case of updating or removing objects. 203 204 Returns error messages as strings in case of requirement 205 problems. 206 """ 207 return None 208 198 209 def checkUpdateRequirements(self, obj, row, site): 199 210 """Checks requirements the object must fulfill when being updated. 200 211 201 212 This method is not used in case of deleting or adding objects. 213 214 Returns error messages as strings in case of requirement 215 problems. 216 """ 217 return None 218 219 220 def checkRemoveRequirements(self, obj, row, site): 221 """Checks requirements the object must fulfill when being removed. 222 223 This method is not used in case of updating or adding objects. 202 224 203 225 Returns error messages as strings in case of requirement … … 329 351 record is stored in the pending data file. 330 352 353 The `BatchProcessor.checkCreateRequirements` method checks additional 354 requirements the parent object must fulfill before a new sububject 355 is being added. These requirements are not imposed by the data 356 type but the context of the object. For example, the course results 357 of graduated students must not changed by import, neither by 358 creating nor updating or removing course tickets. 359 331 360 Now `doImport` tries to add the new object with the data 332 361 from the conversion dictionary. In some cases this … … 359 388 a ``no such entry`` warning message is raised and a record is 360 389 stored in the pending data file. 390 391 The `BatchProcessor.checkRemoveRequirements` method checks additional 392 requirements the object must fulfill before being removed. 393 These requirements are not imposed by the data type but the context 394 of the object. For example, the course results of graduated students 395 must not changed by import, neither by creating nor updating or 396 removing course tickets. 361 397 362 398 Finally, `doImport` removes the existing object. … … 425 461 "This object already exists.") 426 462 continue 463 parent = self.getParent(row, site) 464 create_errors = self.checkCreateRequirements(parent, row, site) 465 if create_errors is not None: 466 num_warns += 1 467 self.writeFailedRow( 468 failed_writer, string_row, create_errors) 469 continue 427 470 obj = self.callFactory() 428 471 # Override all values in row, also … … 453 496 failed_writer, string_row, 454 497 "Cannot remove: no such entry") 498 continue 499 obj = self.getEntry(row, site) 500 remove_errors = self.checkRemoveRequirements(obj, row, site) 501 if remove_errors is not None: 502 num_warns += 1 503 self.writeFailedRow( 504 failed_writer, string_row, remove_errors) 455 505 continue 456 506 self.delEntry(row, site)
Note: See TracChangeset for help on using the changeset viewer.