Re: Callable LazyObject?

2014-03-06 Thread Jeremy Dunck
(It's a change in the DB code, not the template, but your point stands.) I think I agree with you that changing LazyObject is risky when there's a workaround and it would be difficult to address the risk of callable(LazyObject()) becoming true. OK, thanks for feedback. On Thu, Mar 6, 2014 at 8

Re: Callable LazyObject?

2014-03-06 Thread Luke Plant
On 05/03/14 23:05, Jeremy Dunck wrote: > if ... > elif isinstance(value, LazyObject): > pass > elif callable(value): > ... My gut instinct is that if Django's template code has to be patched and special cased to accommodate this change, there will be lots of other code that needs to be

Callable LazyObject?

2014-03-05 Thread Jeremy Dunck
I recently had a need for a LazyObject which was callable. The __call__ meta method isn't forwarded to _wrapped, so it's an error to call, even if the underlying _wrapped does support it. In my case, was trying to do the following: User = SimpleLazyObject(lambda: get_user_model()) User()... I