cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vadim Gritsenko <va...@reverycodes.com>
Subject Re: RT: map:call as generic non-redirecting controller code
Date Sun, 08 Jul 2007 02:26:30 GMT
Daniel Fagerstrom wrote:
> Vadim Gritsenko skrev:
>> Daniel Fagerstrom wrote:
>>> I would much prefer to just use the return value of the flowscript:
>>>
>>> myFlowAction() {
>>>   return calculateSomething();
>>> }
>>
>> I don't think this will work with FOM_Cocoon.suicide()
> 
> That was a cryptic message ;) I need some more details to see what is 
> the problem.

Sorry :)

> To give some context: we are not discussing any changes in how you use 
> flowscripts. What we discuss is adding an action that reuses the flow 
> infrastructure. This is for making it easier to write stateless webapps. 
...
> Does the problem you see still apply in the "flow action" scenario?

Yes; here is minimal example of the situation [1]:

   <map:act function="foo">
     <map:generate src="{one}"/>
     <map:transform src="{two}"/>
     <map:serialize/>
   </map:act>

   function foo() {
     bar();
   }

   function bar() {
     baz();
   }

   function baz() {
     // This will work:
     cocoon.result = { one: "one.xml", two: "two.xslt" };
     FOM_Cocoon.suicide();

     // This does not, without refactoring all of the methods above :)
     return { one: "one.xml", two: "two.xslt" };
   }

If you have non trivial amount of javascript already written, it won't be 
possible to use new flowscript actions stuff if they do not work with suicide() 
method.

[1] Here I suggest using different syntax for flowscript actions, not regular 
map:call, to remove any possible confusion, and we can preserve existing 
behavior of map:call.

Vadim

Mime
View raw message