You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Patrick Verboom <pa...@juwimm.com> on 2004/07/22 09:30:24 UTC

using jython/python for cocoon cform flow

Hi,

I am not a big fan of JavaScript but I am of python. So I would like to 
use jython/python instead of JavaScript.
Is there any documentation of how to do this? Some examples maybe?

Or can someone give me some answers on the hand of a small example here.
The following example is in JavaScript

******************************************************************
cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/v2/Form.js");

function showShoppingCart() {
    var form = new Form("shoppingcart.xml");
    var wid = form.getWidget();
   
    //accessing the repeater to set the values
    wid.cart[0].Stk.value = "1";
    wid.cart[0].Title.value =  "a title";
    wid.cart[1].Stk.value =  "2";
    wid.cart[1].Title.value =  "a second title";
   
    wid.buttonName = "Order";
    form.setBookmark();   

    // showForm() repeatedly sends the form to the browser and doesn't 
return until validation is complete.
    form.showForm("shoppingcart-display-pipeline");   
}
**********************************************************************

How would you rewrite this to jython/python? What module do I need to 
load? How can i create a Form and set the values in the repeater? how do 
i show the form? etc. questions over question :-)

Does someone have any experience in using jython as a flow script?

Thanks in advance for the help
Greetings
Patrick Verboom



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: using jython/python for cocoon cform flow

Posted by Tony Collen <co...@umn.edu>.
Jean-Baptiste Quenot wrote:

> * Reinhard Poetz:
> 
> 
>>Unfortunatly this is not that easy. First you (we) would need a Python
>>interpreter that is able to  manage continuations which doesn't exist,
>>AFAIK.
> 
> 
> Yes it exists, it is called [1]Stackless.

Last time I checked there were no plans to port Stackless to Jython.

Tony


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: using jython/python for cocoon cform flow

Posted by Jean-Baptiste Quenot <jb...@anyware-tech.com>.
* Reinhard Poetz:

> Unfortunatly this is not that easy. First you (we) would need a Python
> interpreter that is able to  manage continuations which doesn't exist,
> AFAIK.

Yes it exists, it is called [1]Stackless.
-- 
Jean-Baptiste Quenot
Anyware Technologies
[1] http://www.stackless.com/spcpaper.htm

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: using jython/python for cocoon cform flow

Posted by Reinhard Poetz <re...@apache.org>.
Patrick Verboom wrote:

> Hi,
>
> I am not a big fan of JavaScript but I am of python. So I would like 
> to use jython/python instead of JavaScript.
> Is there any documentation of how to do this? Some examples maybe?
>
> Or can someone give me some answers on the hand of a small example here.
> The following example is in JavaScript
>
> ******************************************************************
> cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/v2/Form.js"); 
>
>
> function showShoppingCart() {
>    var form = new Form("shoppingcart.xml");
>    var wid = form.getWidget();
>      //accessing the repeater to set the values
>    wid.cart[0].Stk.value = "1";
>    wid.cart[0].Title.value =  "a title";
>    wid.cart[1].Stk.value =  "2";
>    wid.cart[1].Title.value =  "a second title";
>      wid.buttonName = "Order";
>    form.setBookmark();  
>    // showForm() repeatedly sends the form to the browser and doesn't 
> return until validation is complete.
>    form.showForm("shoppingcart-display-pipeline");   }
> **********************************************************************
>
> How would you rewrite this to jython/python? What module do I need to 
> load? How can i create a Form and set the values in the repeater? how 
> do i show the form? etc. questions over question :-)
>
> Does someone have any experience in using jython as a flow script?
>
> Thanks in advance for the help
> Greetings
> Patrick Verboom

Unfortunatly this is not that easy. First you (we) would need a Python
interpreter that is able to manage continuations which doesn't exist,
AFAIK. Then we could integrate this new interpreter language into Cocoon and then we could rewrite the script using Python.

-- 
Reinhard


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org