You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Laurent Mauron <la...@lavalamp.ch> on 2003/12/18 13:35:17 UTC
Python Script Generator
I am trying to use the ScriptGenerator with python on cocoon 2.1.3. Somehow, there is no sample available in the distribution and after hours of googling I still haven't found an example. Could someone points me to the right direction?
Thanks
Laurent
Re: Python Script Generator
Posted by Joerg Heinicke <jo...@gmx.de>.
On 03.01.2004 10:19, Laurent Mauron wrote:
> I wrote a short wiki entry a couple of weeks ago.
>
> http://wiki.cocoondev.org/Wiki.jsp?page=PythonScriptGenerator
>
> I would be glad to add a more detailed entry in the official doc.
>
> Regards,
>
> L.
Ah, I didn't see it. Thanks for your effort.
Joerg
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Python Script Generator
Posted by Laurent Mauron <la...@lavalamp.ch>.
I wrote a short wiki entry a couple of weeks ago.
http://wiki.cocoondev.org/Wiki.jsp?page=PythonScriptGenerator
I would be glad to add a more detailed entry in the official doc.
Regards,
L.
----- Original Message -----
From: "Joerg Heinicke" <jo...@gmx.de>
To: <us...@cocoon.apache.org>
Sent: Friday, January 02, 2004 8:52 PM
Subject: Re: Python Script Generator
> Can you collect your knowledge with the PythonGenerator in a wiki page
> or in an official documentation that will committed to the CVS?
>
> Thanks,
>
> Joerg
>
> On 19.12.2003 12:38, Laurent Mauron wrote:
> > After looking at the ScriptGenerator.java source, I found the
solution...
> > Here is a sample..
> >
> > #get output string buffer
> > output = bsf.lookupBean( "output" )
> >
> > #Get the Parameters object
> > parameters = bsf.lookupBean("parameters")
> >
> >
> > #get the value of the "param_1" parameter defined in the sitemap
> > print parameters.getParameter("param_1")
> >
> > #output a dummy message
> > output.append("<msg>Hello World</msg>")
> >
> >
> > Laurent
> >
> > ----- Original Message -----
> > From: Laurent Mauron
> > To: users@cocoon.apache.org
> > Sent: Friday, December 19, 2003 10:15 AM
> > Subject: Re: Python Script Generator
> >
> >
> > Well, I-ve made some progress.
> > After copying the jython.jar in the web-inf directory and adding this
pipeline
> >
> > <map:match pattern="test.py">
> > <map:generate src="test.py" type="script"/>
> > <map:serialize type="xml"/>
> > </map:match>
> >
> > I'm able to execute the test.py python script inside cocoon. Print
statements are displayed in the console. Now, how do I interact with cocoon,
that is
> >
> > 1) getting parameters from the sitemap in the script
> > 2) generating xml for cocoon
> >
> > I have the feeling it has to do with the bsf object but again I
couldn't find any example of how it can be done. I know there was a sample
in the 2.0.4 version but it disappeared in 2.1. Where can I find it?
> >
> > Thanks,
> >
> > Laurent
> > ----- Original Message -----
> > From: Laurent Mauron
> > To: users@cocoon.apache.org
> > Sent: Thursday, December 18, 2003 1:35 PM
> > Subject: Python Script Generator
> >
> >
> > I am trying to use the ScriptGenerator with python on cocoon 2.1.3.
Somehow, there is no sample available in the distribution and after hours of
googling I still haven't found an example. Could someone points me to the
right direction?
> >
> > Thanks
> >
> > Laurent
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Python Script Generator
Posted by Joerg Heinicke <jo...@gmx.de>.
Can you collect your knowledge with the PythonGenerator in a wiki page
or in an official documentation that will committed to the CVS?
Thanks,
Joerg
On 19.12.2003 12:38, Laurent Mauron wrote:
> After looking at the ScriptGenerator.java source, I found the solution...
> Here is a sample..
>
> #get output string buffer
> output = bsf.lookupBean( "output" )
>
> #Get the Parameters object
> parameters = bsf.lookupBean("parameters")
>
>
> #get the value of the "param_1" parameter defined in the sitemap
> print parameters.getParameter("param_1")
>
> #output a dummy message
> output.append("<msg>Hello World</msg>")
>
>
> Laurent
>
> ----- Original Message -----
> From: Laurent Mauron
> To: users@cocoon.apache.org
> Sent: Friday, December 19, 2003 10:15 AM
> Subject: Re: Python Script Generator
>
>
> Well, I-ve made some progress.
> After copying the jython.jar in the web-inf directory and adding this pipeline
>
> <map:match pattern="test.py">
> <map:generate src="test.py" type="script"/>
> <map:serialize type="xml"/>
> </map:match>
>
> I'm able to execute the test.py python script inside cocoon. Print statements are displayed in the console. Now, how do I interact with cocoon, that is
>
> 1) getting parameters from the sitemap in the script
> 2) generating xml for cocoon
>
> I have the feeling it has to do with the bsf object but again I couldn't find any example of how it can be done. I know there was a sample in the 2.0.4 version but it disappeared in 2.1. Where can I find it?
>
> Thanks,
>
> Laurent
> ----- Original Message -----
> From: Laurent Mauron
> To: users@cocoon.apache.org
> Sent: Thursday, December 18, 2003 1:35 PM
> Subject: Python Script Generator
>
>
> I am trying to use the ScriptGenerator with python on cocoon 2.1.3. Somehow, there is no sample available in the distribution and after hours of googling I still haven't found an example. Could someone points me to the right direction?
>
> Thanks
>
> Laurent
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Python Script Generator
Posted by Laurent Mauron <la...@lavalamp.ch>.
After looking at the ScriptGenerator.java source, I found the solution...
Here is a sample..
#get output string buffer
output = bsf.lookupBean( "output" )
#Get the Parameters object
parameters = bsf.lookupBean("parameters")
#get the value of the "param_1" parameter defined in the sitemap
print parameters.getParameter("param_1")
#output a dummy message
output.append("<msg>Hello World</msg>")
Laurent
----- Original Message -----
From: Laurent Mauron
To: users@cocoon.apache.org
Sent: Friday, December 19, 2003 10:15 AM
Subject: Re: Python Script Generator
Well, I-ve made some progress.
After copying the jython.jar in the web-inf directory and adding this pipeline
<map:match pattern="test.py">
<map:generate src="test.py" type="script"/>
<map:serialize type="xml"/>
</map:match>
I'm able to execute the test.py python script inside cocoon. Print statements are displayed in the console. Now, how do I interact with cocoon, that is
1) getting parameters from the sitemap in the script
2) generating xml for cocoon
I have the feeling it has to do with the bsf object but again I couldn't find any example of how it can be done. I know there was a sample in the 2.0.4 version but it disappeared in 2.1. Where can I find it?
Thanks,
Laurent
----- Original Message -----
From: Laurent Mauron
To: users@cocoon.apache.org
Sent: Thursday, December 18, 2003 1:35 PM
Subject: Python Script Generator
I am trying to use the ScriptGenerator with python on cocoon 2.1.3. Somehow, there is no sample available in the distribution and after hours of googling I still haven't found an example. Could someone points me to the right direction?
Thanks
Laurent
Re: Python Script Generator
Posted by Laurent Mauron <la...@lavalamp.ch>.
Well, I-ve made some progress.
After copying the jython.jar in the web-inf directory and adding this pipeline
<map:match pattern="test.py">
<map:generate src="test.py" type="script"/>
<map:serialize type="xml"/>
</map:match>
I'm able to execute the test.py python script inside cocoon. Print statements are displayed in the console. Now, how do I interact with cocoon, that is
1) getting parameters from the sitemap in the script
2) generating xml for cocoon
I have the feeling it has to do with the bsf object but again I couldn't find any example of how it can be done. I know there was a sample in the 2.0.4 version but it disappeared in 2.1. Where can I find it?
Thanks,
Laurent
----- Original Message -----
From: Laurent Mauron
To: users@cocoon.apache.org
Sent: Thursday, December 18, 2003 1:35 PM
Subject: Python Script Generator
I am trying to use the ScriptGenerator with python on cocoon 2.1.3. Somehow, there is no sample available in the distribution and after hours of googling I still haven't found an example. Could someone points me to the right direction?
Thanks
Laurent