On Fri, 2006-08-11 at 05:40 -0700, PythonistL wrote:
> Hello Malcom,
> Thank you for your reply.
> The value of resolve_variable(EndTime, context) is
> 2006-08-10 12:56:00

No, that isn't necessarily it's value. That's what happens when you
convert it to a string (which could be quite different from the value).
Suppose you do something like

        x = resolve_variable(EndTime, context)
        print type(x), repr(x)
        
in your template tag code (where you do the subtraction you showed
earlier). That will tell you the type and what it really thinks it is
and enable you to start probing deeper. Maybe you need to replace print
with writing to a file or printing to sys.stderr -- that will depend on
how you're testing this stuff.

You could also try printing the result of the subtraction at that point,
just to make sure what you are seeing in your template is really what
you are computing in the code.

> but how can I find out the  type in template tag?
> 
> When I try something like this
>  context['Type']=type(resolve_variable(self.EndTime, context))
> im my tag
> and in template I use {{Type}} it is an empty

Because the output of type() in Python is wrapped in angle brackets
(<...>), as you can see from an interactive prompt, you probably want to
display {{ Type|escape }}, otherwise your browser will interpret it as
an HTML tag.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to