Changeset 7937


Ignore:
Timestamp:
21 Mar 2012, 16:50:51 (13 years ago)
Author:
Henrik Bettermann
Message:

Add method to check constraints objects must fulfill before being updated. This method is needed for updating verdicts and validating course lists of students.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/utils/batching.py

    r7933 r7937  
    187187        """
    188188        raise NotImplementedError('method not implemented')
     189
     190    def checkConstraints(self, obj, row, site):
     191        """Checks constraints the object must fulfill
     192        before being updated.
     193        """
     194        return False
    189195
    190196    def updateEntry(self, obj, row, site):
     
    327333                        "Cannot update: no such entry.")
    328334                    continue
     335                update_errors = self.checkConstraints(obj, row, site)
     336                if update_errors is not False:
     337                    num_warns += 1
     338                    self.writeFailedRow(
     339                        failed_writer, string_row, update_errors)
     340                    continue
    329341                self.updateEntry(obj, row, site)
    330342            finished_writer.writerow(string_row)
Note: See TracChangeset for help on using the changeset viewer.