Leo Soto M. | 21 Jul 06:01

Some modjy questions/proposals

Hello list, and specially Alan Kennedy ;)

I have been playing with modjy the weekend and have two small
questions/proposals:

 1. I see that SCRIPT_NAME is directly set from getServletPath(). This
ignores the context path, which from what I understand from the WSGI
spec[1] ("The initial portion of the request URL's "path" that
corresponds to the application object, so that the application knows
its virtual "location""), should also be included. Also, looks like
the JRuby guys are also prepending the context root[2]. Or am I
missing something?

 2. What about having a predefined directory analogous to WEB-INF/lib,
but for python code (i.e, to get added on sys.path). How about
WEB-INF/lib-python?

This way, we could have the following hierarchy inside WAR files:
.
|-- WEB-INF
|   |-- classes
|   |-- lib
|   |   |-- jython.jar
|   |   |-- modjy.jar
|   |   `-- postgresql-jdbc3-8.2.jar
|   |-- lib-python
|   |   |-- django
|   |   |-- jython-lib.jar
|   |   `-- my_django_project
|   `-- web.xml
(Continue reading)

Alan Kennedy | 21 Jul 22:02
Favicon

Re: Some modjy questions/proposals

Hi Leo,

Thanks for all your work on Django on Jython; I think it is, and will
continue to be, a great booster for jython adoption.

[Leo]
> 1. I see that SCRIPT_NAME is directly set from getServletPath().
> This ignores the context path,

Indeed, that's the way it is in the current release. But you are
correct that it should refer to the context path; I have that
modification made here locally, but I haven't released it yet.

So SCRIPT_NAME should computed like so (from the modjy_publish.py file)

def map_uri(self, req, environ):
  script_name = "%s%s" % (req.getContextPath(), req.getServletPath())
  path_info = req.getPathInfo() or ""

>  2. What about having a predefined directory analogous to WEB-INF/lib,
> but for python code (i.e, to get added on sys.path). How about
> WEB-INF/lib-python?

Hmmm; I'm not sure what the benefit is. I'm hesitant to change the
expectation of where stuff should live; if it's non-standard, it may
create problems for java people, who expect everything to be in the
standard WEB-INF/classes and WEB-INF/lib directories.

> This way, we could have the following hierarchy inside WAR files:
> .
(Continue reading)

Leo Soto M. | 21 Jul 22:48

Re: Some modjy questions/proposals

On Mon, Jul 21, 2008 at 4:02 PM, Alan Kennedy <jython-dev <at> xhaus.com> wrote:
> Hi Leo,
>
> Thanks for all your work on Django on Jython; I think it is, and will
> continue to be, a great booster for jython adoption.
>
> [Leo]
> > 1. I see that SCRIPT_NAME is directly set from getServletPath().
> > This ignores the context path,
>
> Indeed, that's the way it is in the current release. But you are
> correct that it should refer to the context path; I have that
> modification made here locally, but I haven't released it yet.

Cool. Do you have a public "devel" repository? If not, and if you do
like mercurial, I'd be happy to host you a repo.

>
> >  2. What about having a predefined directory analogous to WEB-INF/lib,
> > but for python code (i.e, to get added on sys.path). How about
> > WEB-INF/lib-python?

[...]

> The user can control the python.path property of the embedded jython
> interpreter by setting a value for python.path as a servlet parameter,
> which would allow them to hold stuff in a different directory. Might
> your requirement be met by explaining this possibility, along with
> examples, in documentation?
>
(Continue reading)


Gmane