You're right, I messed up with VTL reference guide. Saw the JIRA too, will provide help if I got time (project to be released yesturday).
Thank you, Etienne Massip -----Message d'origine----- De : Nathan Bubna [mailto:[EMAIL PROTECTED] Envoyé : samedi 15 septembre 2007 17:39 À : Velocity Developers List Objet : Re: EvaluateContext : does not take account of inner.localContext On 9/13/07, Massip, Etienne <[EMAIL PROTECTED]> wrote: > Hello, > > the following vtl does not render what is, IMHO, expected : > > #macro(testEval $expr) > > #foreach($value in ["val1", "val2"]) > value is : #evaluate( $expr ) > #end > #end > > #testEval( "${value}" ) > > renders : > > value is : ${value} > value is : ${value} yeah, that doesn't look right to me either. > The reason is that EvaluateContext ctor assigns 'inner.getBaseContext()' > to instance variable 'innerContext', and getBaseContext() does not > return VMContext localContext refs (of the #foreach directive). > > Changing the EvaluateContext ctor so that 'innerContext' is set to > 'inner' allow velocity to render the right result : > > value is : val1 > value is : val2 > > But I'm not sure this would be a correct fix, should the VMContext > return all current refs ? Could you tell me what the normal behavior > is and what is the way all that stuff sould work ? this is what our tests are for. if your change fixes the problem and all existing tests (run "ant test" on the build) pass, then i would call this a correct fix. :) would you be willing to open a JIRA issue and attach a patch for this? it would also be great if you could turn your example above into a testcase so that we can be sure future changes don't break this again. this would be a huge help! > Aside, I noticed in 1.6 UG documentation, that the example for > #evaluate directive taking a reference parameter uses the #include directive. where exactly? i don't see that here: http://velocity.apache.org/engine/devel/user-guide.html#evaluate but perhaps i'm looking in the wrong place. > Thank you ! > > Etienne Massip > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
