On 26/04/12 09:34, Vsevolod Fedorov wrote:
On 04/25/12 20:36, Phil Charlesworth wrote:
I have looked at Seva's code and it doesn't produce any errors on my
system. However, it doesn't access the images at all! If I add some
additional tree items to force it to use images, it works fine even
if I move the images out of the public directory. I attach my version
of his index.py. and it's located in the examples/seva/ sub-directory
of my web root.
I am using an apache server (Xampp for Windows). Is the problem
something to do with the way he is serving using server.py. He is not
by any chance serving index.py, I suppose? Would that cause the
observed problem?
P
I think I know why this is working for you:
You are using apache, configured in such a way, so it gives access to
the whole file system, and by absolute path.
If you will try to use server.py, which I provided in the example, you
will see the problem: you need to make entire file system paths under
server catalog:
-------
$ ./server.py
localhost - - [25/Apr/2012 11:10:26] "GET /public/index.html HTTP/1.1"
200 -
localhost - - [25/Apr/2012 11:10:26] code 404, message File not found
localhost - - [25/Apr/2012 11:10:26] "GET
/home/seva/pyjamas/library/pyjamas/ui/public/tree_white.gif HTTP/1.1"
404 -
localhost - - [25/Apr/2012 11:10:26] code 404, message File not found
localhost - - [25/Apr/2012 11:10:26] "GET
/home/seva/pyjamas/library/pyjamas/ui/public/tree_closed.gif HTTP/1.1"
404 -
------
As you see, I have to make paths like
home/seva/pyjamas/library/pyjamas... under server's catalog for this
to work. (I have pyjamas installed in my /home catalog).
So, as I understand, we have currently two options for pyjd:
1. configure web server so it serves all file system, under absolute
paths.
2. recreate full file system paths under public/ catalog.
In both cases we have different environment in pyjd and pyjs:
In first case, it is bad to make all file system available for
production code.
I second case, your public/ catalog must look different for pyjd and pyjs.
I do not like either of the options :)
Seva
*
* English
* Russian
* English
* Russian
Seva,
Correction to my original reply to this posting of yours.
The 404 file not found comes only if the images are not present in
/public/. If they are, I get 200.
In either case the application works OK as long as the lines
elif pyjd.is_desktop:
return pyjd.pyjdinitpth + "/library/pyjamas/ui/public/"
are present in pygwt.getImageBaseURL()
If I comment those lines out, the application can only find the images
if they are in /public/.
So we are right back to the start of this issue and the reason for the
changes. Without those two lines of code, DisclosurePanel and Tree would
not show their images under pyjd unless you copied them from
library/pyjamas/ui/public/ to your application's public directory. But
that was a difference from pyjs, because pyjs /automatically/ copies
them from library/pyjamas/ui/public/ to the application's /output/
directory.
So, I think perhaps Luke's suggestion that pyjd should somehow do the
same is perhaps the best idea.
However, it is the case that the current code works, in the sense that
there is nothing wrong with the application's screen output or function
-- it's just that the server puts out a 404 status for the image that's
present in the startup screen instead of 200. The other images don't
provoke HTTP transactions at all.
I still sense that I have not exactly reproduced your experience. With
your original index.py it was difficult to tell whether the application
was functioning correctly because the only image it should show is
image_white.gif and it doesn't do anything when you click it. I would be
interesting to know whether my modified index.py produces the right
output for you if you retain the elif pyd.is_desktop: option in
pygwt.getImageBaseURL()
Phil