Various things add layers, for example, the "with" and "for" tags. When you
pass the corresponding end tag, the layer is discarded. So if some of your
domready invocations are within one of these constructs, and your
domready_render is outside, it's not going to see the stuff that was defined
inside.
A way of handling this is to make your renderer a tag that requires an end
tag. It can create the variable (probably pushing it's own layer onto the
context stack) in its opening tag, making its value a mutable, such as a
python list. The domready tags would then append to the list. This avoids
making a new version of the same variable in some inner layer because
you only read the variable, you don't set it: it still has the
original list, it is
the list that is modified. The render renders its template contents, then,
as a final act, emits the javascript in its variable. This is like it being
rendered at the end tag.
You might want to make both tags accept a string argument to use as the
variable name, just in case you discover a need to nest them, say to
accumulate stuff that must occur in an order different from that in which it
appears in the template. You could, of course, default the variable to a
standard name.
Bill
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>