You are getting "infinite" recursion of splices, but Heist checks for
this condition and stops after a fixed number of recursive calls.  The
reason you have infinite recursion is because getParamNode contains
the complete node representing the splice.  Let's pretend that the
contents of getParamNode are actually passed as the first argument to
ccSplice and that it is a raw ByteString representing the XML instead
of the node tree.  Using this notation, here is the call tree.

ccSplice "<cc/>" = "<cc><YY/></cc>"

This return value gets spliced back into the template and recursively
processed for splices.  This generates another call to ccSplice:

ccSplice "<cc><YY/></cc>" = "<cc><YY/><YY/></cc>"

...which continues recursing until the limit is reached.

Usually, you won't want recursion in your splices, so the general rule
is that the node returned by getParamNode should not be directly
returned from your splice.  You should get values from it that are
used to construct your return value.  If you do need to return it, in
some modified form, you need to either turn off recursive processing
using the stopRecursion function, or have some kind of a termination
case to stop the implicit infinite recursion.


On Wed, Dec 8, 2010 at 3:23 AM, Canhua <[email protected]> wrote:
> hi,
>
> hi, I am using heist, I encounter a problem as described in
> https://gist.github.com/733014, wherein related code is pasted, as
> well as running result that is commented.
>
> I wonder where do so many repeated <YY/> come from
>
> Thank you
> _______________________________________________
> Snap mailing list
> [email protected]
> http://mailman-mail5.webfaction.com/listinfo/snap
>
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap

Reply via email to