- Alexey.
Matt Benson wrote:
--- Alexey Solofnenko <[EMAIL PROTECTED]> wrote:Sorry about that. Personally I would prefer "expression" attribute to contain an expression itself - it is supposed to be simple.That still doesn't address the situation I mentioned, whereby some arbitrary scripty stuff is done to calculate a final result, then return it. It seems that experience has shown we shouldn't discriminate between an attribute and nested text. Maybe a different attribute name would better express the concept I am after. -Matt- Alexey. On 7/31/07, Matt Benson <[EMAIL PROTECTED]> wrote:--- Alexey Solofnenko <[EMAIL PROTECTED]> wrote:It is just a thought - should ScriptFilter, ScriptMapper, ... also return a value instead of setting it?mmmm.... I don't know! :) In hindsight maybe it would have been better to leave this can of worms unmolested rather than deal with these concepts of consistency... I suppose that in either of those cases it might well be reasonable to handle areturnvalue. But with good old Python, what--you can't execute arbitrary junk, return a value, andconsiderthat an evaluation? Jython seems to be a pain overall... seems like every time I have to dealwithit there's a headache involved. If we do extendthisconcept, I suppose we could pull up "expression"toAbstractScriptComponent, and have evaluate()delegateto execute() and return null when expression == false... then any type that wanted to support areturnvalue could just switch to calling evaluate andprefera return value to whatever its "legacy" mechanisms were. How does this sound? -Matt- Alexey. On 7/31/07, Matt Benson <[EMAIL PROTECTED]> wrote:--- Alexey Solofnenko <[EMAIL PROTECTED]>wrote:Old code was executing self.setValue() andthecurrent behaviour breaks backward compatibility. I have tried old ScriptCondition.eval() and it fixed the problem. I think we should add"expression"attribute to AbstractScriptComponent and change it to useitwithevaluateScript(), otherwise nested text will be executed witholdexecuteScript() call.Thanks for running this down, Alexey. I seewhereyou're coming from with the "expression"attribute,though I'm not sure I agree it should live allthewayup in AbstractScriptComponent, because wecan'tuse itto automatically drive anything. I am goingtoadd itto ScriptCondition directly; if we change ourmindslater pulling it up shouldn't cause anyproblems.-Matt- Alexey. On 7/31/07, Peter Reilly <[EMAIL PROTECTED]> wrote:For BSF there are two methods to run ascript:eval and exec, In ant 1.6.* the only method supported wasexec.Hence allthe <script*> types called methods on selftosetthe returnvalue. For ant 1.7.0, I modified the scriptingcodetoallow access toeval and exec, but did not modify anycallingtypes to useeval rather than exec. (In fact I did nottesttheeval on anything)I placed it here to allow expressionhandlingfromproperty callbacks- something like <if test='${groovy: abc=="abc"}"> ..., but didnot follow up. I assume that jython does not like a newlineinits expression.one can in python do a = 1 if a > 0: b = 2 however, one cannot do if # a > 0: ... So I think that this is a clear case of BCproblem.It would be nearly impossible to use<scriptcondition> withjythton in it's current state. (I cannot test at the moment due to(bsf/log4j/commonslogging/jython.jar issues) Peter On 7/31/07, Dominique Devienne<[EMAIL PROTECTED]> wrote:On 7/31/07, Matt Benson<[EMAIL PROTECTED]>wrote:<scriptcondition> originally behavedsuchthatadefault value can be declared on thetaskasanattribute, and the embedded script cansetthecondition value. I preserved thisbehavior,but addeda preference for a return value, ifany,fromthescript: again, on the basis that thisseemeda (more)natural behavior to me. DD, you said"notreturning avalue is fine by you"... and that'swhat<scriptcondition> always did, and_should_stillallow... am _I_ missing anything(otherthanwhateverI've apparently done to break pythoncompatibility)?Ah, sorry, I meant that "not returning avalueis meaningless to me".Sure, if a default value for theconditionisset as an attribute, whynot (although I don't see why that'snecessaryor useful), but ascriptcondition is supposed to be ascriptfragment which returns aboolean value, and I don't see the pointofnotreturning a value.--DD PS: The error message could be nicerthough;-)---------------------------------------------------------------------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]-- Alexey N. Solofnenko Home: http://trelony.cjb.net/ Pleasant Hill, CA (GMT-8 usually)____________________________________________________________________________________Choose the right car based on your needs.Checkout Yahoo! Autos new CarFinder tool. http://autos.yahoo.com/carfinder/---------------------------------------------------------------------To unsubscribe, e-mail:[EMAIL PROTECTED]For additional commands, e-mail:[EMAIL PROTECTED]-- Alexey N. Solofnenko Home: http://trelony.cjb.net/ Pleasant Hill, CA (GMT-8 usually)____________________________________________________________________________________Pinpoint customers who are looking for what yousell.http://searchmarketing.yahoo.com/---------------------------------------------------------------------To unsubscribe, e-mail:[EMAIL PROTECTED]For additional commands, e-mail:[EMAIL PROTECTED]-- Alexey N. Solofnenko Home: http://trelony.cjb.net/ Pleasant Hill, CA (GMT-8 usually)____________________________________________________________________________________Choose the right car based on your needs. Check out Yahoo! Autos new Car Finder tool. http://autos.yahoo.com/carfinder/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- ------------------------------------------------------------------------ Alexey N. Solofnenko <http://trelony.cjb.net/> Pleasant Hill, CA (GMT-8 usually)
smime.p7s
Description: S/MIME Cryptographic Signature