|
From: Brian Z. <bri...@ya...> - 2001-02-08 21:05:52
|
> >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.
Does that mean servlet.py will import module (a non-servlet helper
python module) from <context>/module.py? Why not add
contextRoot/WEB-INF/classes to sys.path instead? I know module.py is not
really a java class, but at least it's invisible from browser client.
Where should I really put this module.py? <context>/WEB-INF/lib/ or
<context>/WEB-INF/classes/?
Regards,
/Brian
----- Original Message -----
From: "Finn Bock" <bc...@wo...>
To: <jyt...@li...>
Sent: Monday, February 05, 2001 12:17 PM
Subject: [Jython-dev] PyServlet
> [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
>
> _______________________________________________
> Jython-dev mailing list
> Jyt...@li...
> http://lists.sourceforge.net/lists/listinfo/jython-dev
>
|