#13772 design decision needed

1 view
Skip to first unread message

George Sakkis

unread,
Oct 23, 2010, 5:54:16 AM10/23/10
to Django developers
This has been (rightly) marked as DDN, so I'm wondering if there are
any thoughts on it to move it forward, one way or another. Original
thread at http://groups.google.com/group/django-developers/browse_frm/thread/3b5939ba089bce51/67892d99a9a6aff3.

George

Andrew Godwin

unread,
Oct 24, 2010, 3:42:33 AM10/24/10
to django-d...@googlegroups.com

My personal opinion on this is that we shouldn't put this into pre_save
- I'd rather not have us doing a query before we get that far (and I've
seen quite a few things that do some validation in pre_save, so
cancellation happens reasonably often).

I'm also not particularly fond of adding yet another signal - we risk
making it a mess of connection points, and signal calls, even if empty,
do have overhead.

My preferred solution is either to not ship this, or replace it with a
decorator which does this for you (so you can wrap your pre_save
listener function in the decorator, which does the existence query for
you, and which also passes this information back up to the model
instance so we don't end up doing three queries). That way, people who
want this can have it, we don't have a useless extra query in nearly any
scenario, and we don't change current behaviour.

Andrew

Russell Keith-Magee

unread,
Oct 25, 2010, 10:28:38 AM10/25/10
to django-d...@googlegroups.com

For the record, I concur with Andrew's reasoning.

Yours,
Russ Magee %-)

George Sakkis

unread,
Oct 25, 2010, 3:11:52 PM10/25/10
to Django developers
On Oct 25, 4:28 pm, Russell Keith-Magee <russ...@keith-magee.com>
wrote:
> On Sun, Oct 24, 2010 at 3:42 PM, Andrew Godwin <and...@aeracode.org> wrote:
> >  On 23/10/10 12:54, George Sakkis wrote:
>
> >> This has been (rightly) marked as DDN, so I'm wondering if there are
> >> any thoughts on it to move it forward, one way or another. Original
> >> thread at
> >>http://groups.google.com/group/django-developers/browse_frm/thread/3b....
>
> >> George
>
> > My personal opinion on this is that we shouldn't put this into pre_save -
> > I'd rather not have us doing a query before we get that far (and I've seen
> > quite a few things that do some validation in pre_save, so cancellation
> > happens reasonably often).
>
> > I'm also not particularly fond of adding yet another signal - we risk making
> > it a mess of connection points, and signal calls, even if empty, do have
> > overhead.
>
> > My preferred solution is either to not ship this, or replace it with a
> > decorator which does this for you (so you can wrap your pre_save listener
> > function in the decorator, which does the existence query for you, and which
> > also passes this information back up to the model instance so we don't end
> > up doing three queries). That way, people who want this can have it, we
> > don't have a useless extra query in nearly any scenario, and we don't change
> > current behaviour.
>
> For the record, I concur with Andrew's reasoning.

Fair enough; unless someone objects in the next few days, I'll close
it as wontfix.

George
Reply all
Reply to author
Forward
0 new messages