Hi,

I added the JPython assembler classes to the cvs in the
turbine/util/assemblerbroker/python directory.  This has only been tested on
Tomcat.

I'll work on some documentation for the JPython stuff soon.  In the mean
time:

To compile it you need to download the jpython.jar from www.jpython.org and
add it to your lib directory.  Then you need to run the "prepare-python" ant
task and after that you need to compile all files with the "jar" ant task.

You also need to add the following lines to your
TurbineResources.properties:

services.TurbineAssemblerBrokerService.screen=org.apache.turbine.util.assemb
lerbroker.python.PythonScreenFactory
services.TurbineAssemblerBrokerService.action=org.apache.turbine.util.assemb
lerbroker.python.PythonActionFactory

services.TurbineAssemblerBrokerService.python.path=/path/to/python

The first two lines registers the python assemblers.  The third one is the
location of your python scripts.  You will need to add /screens, /actions
etc. subdirectories to this directory (the same as templates).

Now copy the new turbine.jar and jpython.jar to your WEB-INF/lib directory.

JPython has some trouble with the custom classloader of Tomcat.  We need to
explicitly add all packages with sys.add_package (I got this solution from
the JPyton mailing list).  To do this you need to add a conf.py file to the
/path/to/python/ directory.  conf.py gets added to the top of each file
before it is executed.  This is just to avoid unnecessary duplicate typing.

This file should look something like this (you can of course add some of
your own classes as well):

import java

from java.io import *
from java.util import *

sys.add_package("org.apache.turbine.modules.screens")
sys.add_package("org.apache.turbine.modules")
sys.add_package("org.apache.turbine.util.db")
sys.add_package("org.apache.turbine.util")
sys.add_package("org.apache.turbine.om.security.peer")
sys.add_package("org.webmacro.servlet");

from org.apache.turbine.modules.screens  import VelocityScreen
from org.apache.turbine.modules          import Action
from org.apache.turbine.util.db          import Criteria
from org.apache.turbine.util             import RunData
from org.webmacro.servlet                import WebContext
from org.apache.turbine.om.security.peer import TurbineUserPeer

I'll do a better doc as soon as time permits.

~ Leon



------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to