Wednesday, May 25, 2011

Re: Weird problem with rendering a Variable in a custom tag

On May 25, 4:43 am, stevedegrace <degr...@gmail.com> wrote:
> And you are absolutely correct, using a local variable in the render
> method and not rebinding self,ip resolves the problem. Thank you very
> much. Can you explain why this is?

"Once a node is parsed, its render method may be called any number of
times"
(http://docs.djangoproject.com/en/1.3/howto/custom-template-tags/
#thread-safety-considerations
)

If you wan to make sure, just add a couple print statements (or better
use the logger) in the __init__ and render methods.

HTH

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment