Correct way to unlazify a SimpleLazyObject?

57 views
Skip to first unread message

Hanne Moa

unread,
Dec 18, 2009, 5:52:23 PM12/18/09
to django...@googlegroups.com
I recently got burned by r11626, which added SimpleLazyObject to
1.1.x. I have a templatetag that linkifies a user-object, and it
checks whether it is given a django.contrib.auth.models.User, an int
(looks up a User) or a profile (looks up the User). This check was
done with type(). Unfortunately, type(SimpleLazyObject) !=
type(User()), so I had a "fun" TemplateSyntaxError in my hands.

However, the TemplateSyntaxError never happened if there was an
instance of {{ user }} before the {% prettylinktouser user %} in the
template, thus it seems to me that just outputting a SimpleLazyObject
somehow unlazifies it. So, how can a SimpleLazyObject be unlazified
everywhere else?


HM

Reply all
Reply to author
Forward
0 new messages