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 [email protected].
To post to this group, send email to [email protected].
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.

Reply via email to