Re: Finalizing descriptor implementation

2006-03-09 Thread Luke Plant
Russell Keith-Magee wrote: > On 3/9/06, Luke Plant <[EMAIL PROTECTED]> wrote: > > > > On Tuesday 07 March 2006 14:49, Russell Keith-Magee wrote: > > > > > > > 3) What is to become of the _id fields for ForeignKeys? > > > > Isn't this covered by descriptor caching? One initial DB hit to get > > >

Re: Finalizing descriptor implementation

2006-03-09 Thread Russell Keith-Magee
On 3/9/06, Max Battcher <[EMAIL PROTECTED]> wrote: > > Speaking of which: right now the Template engine isn't swallowing the > Descriptor's DoesNotExist. I mentioned this and posted a patch: Thanks, Max - I'll add this one to my todo list for this pass at descriptor work. Russ Magee %-) --~--~

Re: Finalizing descriptor implementation

2006-03-09 Thread Russell Keith-Magee
On 3/9/06, Luke Plant <[EMAIL PROTECTED]> wrote: > > On Tuesday 07 March 2006 14:49, Russell Keith-Magee wrote: > > > > > 3) What is to become of the _id fields for ForeignKeys? > > Isn't this covered by descriptor caching? One initial DB hit to get > > the related object, and then all subsequent

Re: Finalizing descriptor implementation

2006-03-08 Thread Max Battcher
On 3/6/06, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote: > I think that if the foreign key is None (for whatever reason), then > __get__ should return None; otherwise it should expect a valid > reference to exist and raise DoesNotExist. (For template authors, > note that DoesNotExist exceptions ar

Re: Finalizing descriptor implementation

2006-03-08 Thread Luke Plant
On Tuesday 07 March 2006 14:49, Russell Keith-Magee wrote: > > > 3) What is to become of the _id fields for ForeignKeys? > > > > They need to stay around for efficiency; I'd like not to have to do > > a db hit just to find the id of something I've already got. Often > > in bulk-data-import situa

Re: Finalizing descriptor implementation

2006-03-07 Thread kmh
Russell Keith-Magee wrote: > In addition, your alternative would have 'X = article.reporter_set' > provide useful data, but 'article.reporter_set = X' throw an exception > - this asymmetry strikes me as much more confusing than the absence of > strict name binding. This is a good point, but at le

Re: Finalizing descriptor implementation

2006-03-07 Thread Russell Keith-Magee
On 3/7/06, kmh <[EMAIL PROTECTED]> wrote: > > Thanks for the nice roundup. Votes may be in but just to clarify: my > primary objection is that assignment is fundamentally a name-binding > operation in Python and in this case what is bound to the name is not > what is returned. The fact that the

Re: Finalizing descriptor implementation

2006-03-07 Thread Russell Keith-Magee
On 3/7/06, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote: > > Russ, I can't thank you enough for your work on this stuff. Half > these edge cases I wouldn't have even thought of 'til they bit me in > the ass -- I really appreciate it :) More than welcome. Being on the other side of the world makes

Re: Finalizing descriptor implementation

2006-03-07 Thread Ivan Sagalaev
hugo wrote: >I would be +1 on this. Especially since transactions are already in >m-r, so we won't have to worry about multiple save points playing havoc >with our database connection. > I'd say -1. For it's not about database it's about what is expected behavior. Currently I'm never sure what c

Re: Finalizing descriptor implementation

2006-03-06 Thread kmh
Russell Keith-Magee wrote: >1) What should be the behaviour of __set__ for descriptors where > multiple values are allowed (ForeignKey, ManyToManyField)? > Known Objections: > Kieren Holland suggested that Article.reporter_set = [r1,r2] implies > that reporter_set is an ordered collection, becau

Re: Finalizing descriptor implementation

2006-03-06 Thread Jacob Kaplan-Moss
Howdy -- Russ, I can't thank you enough for your work on this stuff. Half these edge cases I wouldn't have even thought of 'til they bit me in the ass -- I really appreciate it :) Now, onto your questions: > I propose that: 'Article.reporter_set = X' be allowed, where X is any > iterable.

Re: Finalizing descriptor implementation

2006-03-06 Thread hugo
Hi! >1) What should be the behaviour of __set__ for descriptors where >multiple values are allowed (ForeignKey, ManyToManyField)? Allow assignement of any iterator. If people are confused by the fact that a list has an order and a set doesn't, they will be confused by the fact of sets themselves

Re: Finalizing descriptor implementation

2006-03-06 Thread Russell Keith-Magee
On 3/6/06, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > 2) If a related attribute currently has a value of None, should the > > __get__ method return None, or raise a DoesNotExist if accessed? Does > > this behaviour change if the attribute is set null=True? > > I don't understand this, becau

Re: Finalizing descriptor implementation

2006-03-06 Thread Luke Plant
> 2) If a related attribute currently has a value of None, should the > __get__ method return None, or raise a DoesNotExist if accessed? Does > this behaviour change if the attribute is set null=True? > > Personally, I am: > +1 returning None if null=True > +0 returning None if null=False > > 3)

Re: Finalizing descriptor implementation

2006-03-05 Thread Malcolm Tredinnick
Nice summary of things to think about, Russ.== On Mon, 2006-03-06 at 14:30 +0800, Russell Keith-Magee wrote: [...] > 1) What should be the behaviour of __set__ for descriptors where > multiple values are allowed (ForeignKey, ManyToManyField)? > > I propose that: 'Article.reporter_set = X' be all

Finalizing descriptor implementation

2006-03-05 Thread Russell Keith-Magee
Hi all, A combination of recent tinkering with descriptors and a couple of recent threads on mailing lists have collectively revealed a few descriptor edge cases that do not appear to have been the subject of any past discussion. This thread is an attempt to establish the official behaviour for t