Hello ! I am obviously victim of some dark magic...
Here is a template that I render :
context = Context({'my_cube': c})
template = Template(
'{% load cube_templatetags %}'
'{{ my_cube|inspect }} {{ my_cube.measure }}'
)
Here is the implementation of the inspect
filter :
def inspect_object(obj):
return obj.measure()
Here is what the rendering gives me :
>>> template.render(context)
u'6 None'
Does anyone know why the hell does the {{ my_cube.measure }} is not rendered properly, while obviously the function call is successful ???
NB : the measure function does no magic, no internal state is changed, I tested and it gives the same result each time, I also tested to put the inspect before the {{ cube.measure }}.... doesn't change anything. I have absolutely no clue on what's going on...
EDIT :
I know where it seems to be coming from. But it is still strange. For some reason, my object's attribute are not resolved by template.Variable
:
>>> Variable('measure').resolve(c) == None
True
>>> Variable('testitesti').resolve(c) == None
True
>>> c.testitesti()
68
#implementation of testitesti :
def testitesti(self):
return 68