Re: Possible eval/templet bug

Lane Sharman <[email protected]> Mon, 08 Aug 2005 12:45:20 -0700
Newsgroups gmane.comp.java.webmacro.user
Message-ID <[email protected]>
Keats,

What do you think of this? I looked at the logic and I think Marc is right.

I use #templet and #eval a lot and it seems that the contexts are not 
getting pushed correctly? Is there a bug in the stack?

-Lane



Marc Palmer wrote:

>Hi,
>
>I've hit upon what I believe is an obscure bug in #eval/#templet in 2.0 RC1.
>
>I'm finding it with my JSP taglib but I don't believe it is specific to
>the taglib, it smells more like a problem with #templet/eval. Of course a
>unit test will prove this so that will naturally be my next course of
>action. However I can't commit to WM from my workplace.
>
>...evaluating this template:
>
><html>
><body>
>
>#templet $render
>
>Value is: $value
>
>#end
>
>#templet $outerTemplet
>   
>  #set $value = "Hello!"
>  #eval $rendertemplet using {
>	"value" : $value
>  }
>
>#end
>
>#eval $outerTemplet using {
>    "rendertemplet" : $render
>}
>
></body>
></html>
>
>
>...the intention/expectation is that this will simply output:
>
>
><html>
><body>
>
>Value is: Hello!
>
></body>
></html>
>
>
>...but, rather weirdly, you get this:
>
>
><html>
><body>
>
>Value is: <!-- Attempted to write an undefined variable: Hello! at
>render:4.11 -->
>
></body>
></html>
>
>Notice that it says undefined variable "Hello!" - but that is the value of
>the variable! It's like it's trying to recursively evaluate it.
>
>Keats - any thoughts?
>
>I will try to dig into the source and write a unit test for this, but I
>wanted to flag it in case I'm being stupid.
>
>Also, there seems to be an error handling bug. If your innermost templet
>references a non-existent variable, you get something like:
>
>Value is: <!-- Attempted to write an undefined variable: <!-- Attempted to
>write an undefined variable: $iknowthisdoesntexistvalue at unknown:2.58
>--> at render:4.11 -->
>
>
>...notice that this has two error messages and unbalanced "-->" so you get
>some nasty output in the page and interestingly two sources - unknown and
>render. Also note that it gets the error variable name right in this case,
>but in the first problem I talked about it uses the -value- of the
>variable as the "unknown" variable name.
>
>Very confusing!
>
>Cheers
>
>
>
>-------------------------------------------------------
>SF.Net email is Sponsored by the Better Software Conference & EXPO
>September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
>Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
>Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
>_______________________________________________
>Webmacro-user mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/webmacro-user
>
>  
>

-- 
Lane Sharman
Providing Private and SPAM-Free Email
http://www.opendoors.com
858-755-2868



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf