Re: Add support for get_or_none?

2014-03-14 Thread Michael Manfre
Good point. I forgot that some people would do that. On Fri, Mar 14, 2014 at 11:52 AM, Florian Apolloner wrote: > > > On Friday, March 14, 2014 4:50:49 PM UTC+1, Michael Manfre wrote: > >> On Fri, Mar 14, 2014 at 11:15 AM, Cal Leeming [Simplicity Media Ltd] < >> cal.l...@simplicitymedialtd.co.uk

Re: Add support for get_or_none?

2014-03-14 Thread Carl Meyer
On 03/14/2014 09:50 AM, Michael Manfre wrote: > On Fri, Mar 14, 2014 at 11:15 AM, Cal Leeming [Simplicity Media Ltd] > > wrote: > > > .get(or=None) (of some description) would be my preference, but > even that is ugly and confuses the

Re: Add support for get_or_none?

2014-03-14 Thread Florian Apolloner
On Friday, March 14, 2014 4:50:49 PM UTC+1, Michael Manfre wrote: > > On Fri, Mar 14, 2014 at 11:15 AM, Cal Leeming [Simplicity Media Ltd] < > cal.l...@simplicitymedialtd.co.uk > wrote: >> >> >>> .get(or=None) (of some description) would be my preference, but even >>> that is ugly and confuse

Re: Add support for get_or_none?

2014-03-14 Thread Michael Manfre
On Fri, Mar 14, 2014 at 11:15 AM, Cal Leeming [Simplicity Media Ltd] < cal.leem...@simplicitymedialtd.co.uk> wrote: > > >> .get(or=None) (of some description) would be my preference, but even that >> is ugly and confuses the existing API with "special" keywords that aren't >> actually a filter. >>

Re: APPEND_SLASH skip per URL or per base_uri

2014-03-14 Thread Ryan Hiebert
On Fri, Mar 14, 2014 at 10:07 AM, Val Neekman wrote: > > Localized solution is fine, but when I saw the number posts from people > who were trying to find a solution to this, I thought, perhaps it would be > a nice little enhancement to the APPEND_SLASH functionality. > You don't need to avoid A

Re: Add support for get_or_none?

2014-03-14 Thread Cal Leeming [Simplicity Media Ltd]
On Fri, Mar 14, 2014 at 3:08 PM, Josh Smeaton wrote: > Shai has changed my mind. Most uses of the get or none pattern that I've > used could be replaced by .first(), since it's unlikely there will be > multiple objects with the kind of query you'd be using with a get. > The keyword here is `unlik

Re: Add support for get_or_none?

2014-03-14 Thread Cal Leeming [Simplicity Media Ltd]
On Fri, Mar 14, 2014 at 12:41 PM, Shai Berger wrote: > On Thursday 13 March 2014 14:34:18 Josh Smeaton wrote: > > +1 on get_or_none. It seems to be a pattern that comes up quite a lot in > > user code, and I know I've had use for it lots of times. > > Since 1.6, you should just be using first().

Re: Add support for get_or_none?

2014-03-14 Thread Josh Smeaton
Shai has changed my mind. Most uses of the get or none pattern that I've used could be replaced by .first(), since it's unlikely there will be multiple objects with the kind of query you'd be using with a get. I really dislike the get_or_create shortcut syntax, and I don't think a good name for

Re: APPEND_SLASH skip per URL or per base_uri

2014-03-14 Thread Val Neekman
Hi Aymeric, Localized solution is fine, but when I saw the number posts from people who were trying to find a solution to this, I thought, perhaps it would be a nice little enhancement to the APPEND_SLASH functionality. Thanks, Val On Thursday, 13 March 2014 17:12:51 UTC-4, Val Neekman wrote

Re: Add support for get_or_none?

2014-03-14 Thread Cal Leeming [Simplicity Media Ltd]
At present, I'd propose implementing it on the manager - the same as `.get()` I would agree the naming convention does seem out of place, but at the same time, no suitable alternative jumps to mind straight away (any suggestions??) Cal On Thu, Mar 13, 2014 at 9:34 PM, Josh Smeaton wrote: > +1 o

Re: Add support for get_or_none?

2014-03-14 Thread Shai Berger
On Thursday 13 March 2014 14:34:18 Josh Smeaton wrote: > +1 on get_or_none. It seems to be a pattern that comes up quite a lot in > user code, and I know I've had use for it lots of times. Since 1.6, you should just be using first(). Compared to the try-get-except-DoesNotExist-return-None patter