On Wed, 2007-06-13 at 00:11 +0530, Amit Upadhyay wrote:
> Hi,
> 
> Wouldn't it be cool if we can say
> user.save(email="[EMAIL PROTECTED]"), which will do the equivalent
> of user.email = "[EMAIL PROTECTED]"; user.save()? Should be single
> line change, putting a self.__dict__.update(kw) in model.save(). 

Aside from all the other points raised in the reply, there's a
"separation of powers" design principle at work: save() should never
raise validation errors. Validation happens, passes and *then* you can
safely call save(). The save() method might raise database integrity
errors, because we cannot guarantee that some other process entirely
hasn't done something at the db level we don't know about, but that's
all.

Utility functions like create_or_update() are just that: intentional
combinations of the two and you need to be able to handle both types of
errors, but you know what you are getting in for.

Regards,
Malcolm


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to