Re: Implementation of descriptor fields

2006-01-30 Thread Brant Harris
On 1/30/06, Luke Plant <[EMAIL PROTECTED]> wrote: > I attempted something like this first time (I think you mean it would > return a version with caching *enabled* each time, right?), but removed > it again. I wasn't sure how it would interact with things like > _default_manager, and also if you

Re: Implementation of descriptor fields

2006-01-30 Thread Luke Plant
On Monday 30 January 2006 16:04, Brant Harris wrote: > That said... Person.objects could be a property that returns the > Manager/Query. In this way you could send a cacheless version of it > every time it is called, and would work for your first bit of code, > as desired. I attempted somethin

Re: Implementation of descriptor fields

2006-01-30 Thread Brant Harris
Although, I think it'd be great to have it as propsed, at some point the OO of your ORM needs to make consessions to the SQL of your ORM. Which goes back to my earlier proposal. That said... Person.objects could be a property that returns the Manager/Query. In this way you could send a cachele

Re: Implementation of descriptor fields

2006-01-30 Thread Robert Wittams
[EMAIL PROTECTED] wrote: > Adrian Holovaty wrote: > > >>This comes back to the Person.objects.all() thing that I'd mentioned >>earlier. With all(), there's no strange special-case behavior. >>Person.objects.all() would return a cache-filled object, and there >>wouldn't be a need for a QuerySet t

Re: Implementation of descriptor fields

2006-01-30 Thread Luke Plant
Amit Upadhyay wrote: > Have not been following the discussion very closely, but why not have a > parameter use_cache (defaulting to True) in the get_list and making it > completely explicit. Sometimes I like the conveniece of not storing > something in a variable, like from within a template, an

Re: Implementation of descriptor fields

2006-01-30 Thread Amit Upadhyay
On 1/30/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Presumably this needs the same behaviour as a Manager i.e. doesn'tcache.  So the the filter method needs to return a non-caching QuerySet.  To get a caching version, you would have to do .all(), soyou would have to do this everytime you actua

Re: Implementation of descriptor fields

2006-01-30 Thread [EMAIL PROTECTED]
Adrian Holovaty wrote: > This comes back to the Person.objects.all() thing that I'd mentioned > earlier. With all(), there's no strange special-case behavior. > Person.objects.all() would return a cache-filled object, and there > wouldn't be a need for a QuerySet to know whether it could accept >

Re: Implementation of descriptor fields

2006-01-29 Thread Eugene Lazutkin
Adrian Holovaty wrote: This would further simplify things by making a Manager's methods *return* QuerySets instead of having a Manager *be* a QuerySet. The downside is it's slightly more typing to do Person.objects.all() than Person.objects -- but that's the only downside I see. Thoughts? .a

Re: Implementation of descriptor fields

2006-01-29 Thread Adrian Holovaty
On 1/28/06, Luke Plant <[EMAIL PROTECTED]> wrote: > As Robert pointed out before, you usually don't have to worry about > resetting the cache, since the objects will get GC after the template > and views stop using them. However, the Article.objects manager is > special, since it is rooted in a c

Re: Implementation of descriptor fields

2006-01-29 Thread Robert Wittams
> We had this discussion a while back; the goal is to separate > "instance-level" functionality from "table-level" functionality. > Anything that doesn't explicitly act on a model instance goes in the > manager. With that in mind, I'm not sure having Manager subclass > QuerySet (and making it a de

Re: Implementation of descriptor fields

2006-01-28 Thread Adrian Holovaty
On 1/28/06, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > > My mistake -- get_pub_date_list() wasn't the best example. Better > > examples would be completely custom manager methods, such as > > create_user() and and make_random_password() in > > django.contrib.auth.models.UserManager. > > Is t

Re: Implementation of descriptor fields

2006-01-28 Thread Luke Plant
On Saturday 28 January 2006 14:23, Robert Wittams wrote: > Hm, that does make sense. +1 . Except this sentence, which I never managed to finish: > > That would mean that if the manager, for instance, happened to be > > ordered, you would lose ordering if you did an 'or' query, even > > between.

Re: Implementation of descriptor fields

2006-01-28 Thread Robert Wittams
Luke Plant wrote: >>hugo and I talked on IRC about this, probably a couple of months ago >>now. The best we could come up with for the | case was "undefined" - >>probably remove the ordering clause completely. > > > That would mean that if the manager, for instance, happened to be > ordered, y

Re: Implementation of descriptor fields

2006-01-28 Thread Luke Plant
OK, more holes in the proposal. Everything that used to be kwarg to Manager().get_list() (or other methods), now has to alter the state of the QuerySet, otherwise caching won't work. So we have the following that still need sorting out: select_related limit offset params select where tables

Re: Implementation of descriptor fields

2006-01-28 Thread Luke Plant
> hugo and I talked on IRC about this, probably a couple of months ago > now. The best we could come up with for the | case was "undefined" - > probably remove the ordering clause completely. That would mean that if the manager, for instance, happened to be ordered, you would lose ordering if yo

Re: Implementation of descriptor fields

2006-01-28 Thread Robert Wittams
Luke Plant wrote: > Some more implementation questions: > > Presumably: > > Article.objects.order_by(('title',)).order_by(('something_else',)) > == > Article.objects.order_by(('something_else',)) > > so that you can override an ordering (I can't see many use cases for the > alternative i.e. cu

Re: Implementation of descriptor fields

2006-01-28 Thread Luke Plant
Some more implementation questions: Presumably: Article.objects.order_by(('title',)).order_by(('something_else',)) == Article.objects.order_by(('something_else',)) so that you can override an ordering (I can't see many use cases for the alternative i.e. cumulative ordering) But what about thes

Re: Implementation of descriptor fields

2006-01-28 Thread Robert Wittams
Adrian Holovaty wrote: > I've implemented the very first bit of descriptor fields -- the bit > that does poll.choice_set instead of poll.get_choice_list(). > > http://code.djangoproject.com/changeset/2141 > > Just before that, I'd added a core_filters attribute to Managers, > which, if set, is a

Re: Implementation of descriptor fields

2006-01-28 Thread Luke Plant
On Saturday 28 January 2006 00:34, Adrian Holovaty wrote: > I've implemented the very first bit of descriptor fields -- the bit > that does poll.choice_set instead of poll.get_choice_list(). I'm up for doing some work on this, and have some time at the moment, even if it's just converting all the

Re: Implementation of descriptor fields

2006-01-28 Thread Russell Keith-Magee
On 1/28/06, Adrian Holovaty <[EMAIL PROTECTED]> wrote: > > On 1/27/06, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > > On 1/28/06, Adrian Holovaty <[EMAIL PROTECTED]> wrote: > > > An implementation question, though: If foo.objects is a Manager > > > instance, and accessing foo.objects returns a

Re: Implementation of descriptor fields

2006-01-27 Thread Adrian Holovaty
On 1/27/06, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > On 1/28/06, Adrian Holovaty <[EMAIL PROTECTED]> wrote: > > An implementation question, though: If foo.objects is a Manager > > instance, and accessing foo.objects returns a QuerySet instance, how > > would one access the other manager me

Re: Implementation of descriptor fields

2006-01-27 Thread Russell Keith-Magee
On 1/28/06, Adrian Holovaty <[EMAIL PROTECTED]> wrote: > > An implementation question, though: If foo.objects is a Manager > instance, and accessing foo.objects returns a QuerySet instance, how > would one access the other manager methods, such as > foo.objects.get_pub_date_list(), etc.? Isn't ge

Implementation of descriptor fields

2006-01-27 Thread Adrian Holovaty
I've implemented the very first bit of descriptor fields -- the bit that does poll.choice_set instead of poll.get_choice_list(). http://code.djangoproject.com/changeset/2141 Just before that, I'd added a core_filters attribute to Managers, which, if set, is applied to every data-access query for