> > I know it has some implementation issues but I also had another idea in > mind which maybe somebody has some ideas to improve and that it may be less > aggressive in terms of API changes. The idea is to implement deferred > validation in the same way a database implements deferred constraints. > Something like this: > > with Transaction().set_deferred(): > for record in records: > record.field = random.random() > record.save() > > The checks would be executed on all modified records when exiting the with > statement. > > Probably the main issue is that in case of a failure of the validation, it > may be harder to find where and when the value was set incorrectly, but > that's why that should be used in loops and places where the developer > knows beforehand that it can take advantage of deferring the validation. > > One advantage is that it can defer validation in a loop of "create" or > "write" (for example, an import process which checks for the existance of a > record and creates it or updates it accordingly). >
I think this might be a problem. If a given record is not valid, you want to know it before going on with what may be a costly operation. Even though it would be a choice of the developer to use it or not, it seems rather dangerous to me. Jean CAVALLO Coopengo
