On 6/13/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
>
>
> 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.


Points taken.

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.


In that case how about a update_and_save() method?

-- 
Amit Upadhyay
Vakow! www.vakow.com
+91-9820-295-512

--~--~---------~--~----~------------~-------~--~----~
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