From: <bc...@wo...> - 2001-02-05 20:19:05
|
[In a private conversation David Syer raised several good points about PyServlet. Forgive me for taking the private discussion to the list] >You could add getServletContext().getRealPath("/") to sys.path in PyServlet >in the constructor. A good idea. That should take care of most issues with the application part of sys.path. In addition to this, I suggest that we add a fake __file__ attribute to the globals before loading the .py file and before calling the service() method. That way the main .py will know where it is located during load. >Does [the fact sys.prefix is null in PyServlet] explain why the cachedir >is created in a weird place (the web-apps directory, not <path-to-jython.jar>)? Exactly. I've already added the init-params as jython options, so we in web.xml can do: * <init-param> * <param-name>python.home</param-name> * <param-value>/usr/home/jython-2.0</param-value> * </init-param> to set python.home and all the other registry properties. Unfortunately this is mostly useless if we want to set a path to something relative to the webapps folder. And most of the times, that is exactly what we want. So I suggest that unless a specific python.home is set in init-param or System.getProperties(), PyServlet will set python.home to <context>/WEB-INF/lib. This means the jython.jar, the registry file and the ./Lib directory can be distributed in WEB-INF/lib. regards, finn |