(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:12 AM, Luke Plant <l.plant...@cantab.net> wrote:

> 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 patched too.
>
> LazyObject is already pretty hairy without trying to get it to support
> more things.
>
> Also, it seems that normally there should be other solutions. In many
> cases, instead of:
>
>   User = SimpleLazyObject(lambda: get_user_model())
>
> you could use:
>
>   User = lambda **kwargs: get_user_model()(**kwargs)
>
> ...assuming that the only thing you need 'User' to do is to produce User
> instances when you call it. (If you need it to be an actual class for
> some reason, then this won't work - but in most cases I'd suggest that
> the consuming code shouldn't need an actual class).
>
> Regards,
>
> Luke
>
>
> --
> "God demonstrates his love towards us in this, that while we were
> still sinners, Christ died for us." (Romans 5:8)
>
> Luke Plant || http://lukeplant.me.uk/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To post to this group, send email to django-developers@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/53189E5F.7010306%40cantab.net
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAM0i3f4Li3Bqsz6sd1d3LURZzeOH_gQ05gK4XUdF_7GsdAL%2B8A%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to