Re: Possible improvement to model API

2007-02-10 Thread David Abrahams
"Karen Tracey" <[EMAIL PROTECTED]> writes: > "Karen Tracey" <[EMAIL PROTECTED]> > writes: > > The fix for #2348 changes the error from "Unbound local error" to "Type > error: cannot > resolve > > keyword [whatever] into field". > > Illustrating just why the current sy

Re: Amendment: Possible improvement to model API

2007-02-10 Thread David Abrahams
"Adrian Holovaty" <[EMAIL PROTECTED]> writes: > On 2/9/07, David Abrahams <[EMAIL PROTECTED]> wrote: >> Entry.objects.filter( >> _.headline.startswith('What') & >> ~(_.pub_date>=datetime.now()) & >>

Re: Possible improvement to model API

2007-02-10 Thread David Abrahams
"Karen Tracey" <[EMAIL PROTECTED]> writes: > On 2/9/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > > However, you have obviously been bitten by a bad error message - I > would suggest that a good course of action would be to raise a ticket > with your specific example so that th

Re: Possible improvement to model API

2007-02-09 Thread David Abrahams
ntation *considerably* more arcane. I *seriously* doubt that. This feature is really simple to implement. Maybe I'll have to code it to prove that, but from the number of "I'm not a fan of..." responses I'm seeing here, I doubt that knowing it's simple would make much d

Re: Possible improvement to model API

2007-02-09 Thread David Abrahams
Malcolm Tredinnick <[EMAIL PROTECTED]> writes: > On Fri, 2007-02-09 at 21:14 -0500, David Abrahams wrote: >> _.foo >= 6 returns an expression tree, an object that represents >> the comparison of the foo field with 6. This technique is well-known >> among advance

Re: Amendment: Possible improvement to model API

2007-02-09 Thread David Abrahams
"Lawrence Oluyede" <[EMAIL PROTECTED]> writes: >> > --- >> > from django.models import field as _ >> > >> > Entry.objects.filter( >> > _.headline.startswith('What')).exclude( >> > _.pub_date>=datetime.now()).filter( >> > _.pub_date>=datetime(2005, 1, 1)) >> >> Should b

Re: Possible improvement to model API

2007-02-09 Thread David Abrahams
Malcolm Tredinnick <[EMAIL PROTECTED]> writes: > On Sat, 2007-02-10 at 08:30 +0800, Russell Keith-Magee wrote: >> On 2/10/07, David Abrahams <[EMAIL PROTECTED]> wrote: >> > >> >Use natural operators for filtering, excluding, and attribute >> &g

Re: Possible improvement to model API

2007-02-09 Thread David Abrahams
"Russell Keith-Magee" <[EMAIL PROTECTED]> writes: > On 2/10/07, David Abrahams <[EMAIL PROTECTED]> wrote: >> >>Use natural operators for filtering, excluding, and attribute >>access. > >> How about it? > > Some immediate proble

Amendment: Possible improvement to model API

2007-02-09 Thread David Abrahams
David Abrahams <[EMAIL PROTECTED]> writes: > --- > from django.models import field as _ > > Entry.objects.filter( > _.headline.startswith('What')).exclude( > _.pub_date>=datetime.now()).filter( > _.pub_date>=datetime(200

Possible improvement to model API

2007-02-09 Thread David Abrahams
What's wrong with this picture? TimeDivision.objects.filter(when__ge=datetime(2007,5,14)) Whoops. "Greater or equal" is spelled 'gte' and not 'ge' in Django's model API. After having fallen into this trap and getting a cryptic error message (UnboundLocalError: local variable 'new_opts' refer