On 2006-02-22, at 11:18 CET, hugo wrote: > I would propose to instead do validation in those situations where the > data is moved to the external storage - on .save() (or in the > unit-of-works .save() if we have them). That way you can happily > create > invalid objects, but you will be forced to make them valid to save > them. An additional .validate() method could be introduced that will > trigger validation without saving to allow programmers to do early > validation if they need to.
I'm definitely +1 on this, when I'm looked trough my current code- base I found lot's of examples of creating invalid objects and later (before .save()) adding required data to make it valid and (as someone else also pointed out) I have more than few cases of mutually dependent fields which can't be changed in one property access. --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://studioquattro.biz/ http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ | http://djangoutils.python-hosting.com/ Registered Linux User 282159 [http://counter.li.org]
PGP.sig
Description: This is a digitally signed message part