On 26/04/12 12:45, Vsevolod Fedorov wrote:
>> Seva,
>>
>>        I have also been using a url of
>> "http://localhost:8080/public/index.html"; with your server and my recent
>> reports have been based on that. My apache server was not running. So my
>> test was strictly comparable with yours, apart from the operating system
>> (I presume you are running Linux).
>>
>> Phil
>>      
> Yes, I use Linux.
> Hm. This is very strange.
> Can you show me your output from server.py?
>
> Seva
>    
Seva,
First Test: server.py and index.py in same directory, index.html in 
public sub-directory. No images in public.
python server.py from a cmd window. python index.py from a separate cmd 
window
Server output:
Deborah - - [26/Apr/2012 14:42:20] "GET /public/index.html HTTP/1.1" 200 -
Deborah - - [26/Apr/2012 14:42:20] code 404, message File not found
Deborah - - [26/Apr/2012 14:42:20] "GET /public/tree-closed.gif 
HTTP/1.1" 404 -

The application displays as it should with tree-closed images and the 
the branches can be opened and then display tree-open images.

Second Test: exactly as first test except the images are copied into the 
public sub-directory.
Server Output:
Deborah - - [26/Apr/2012 14:57:01] "GET /public/index.html HTTP/1.1" 200 -
Deborah - - [26/Apr/2012 14:57:01] "GET /public/tree-closed.gif 
HTTP/1.1" 200 -

The application behaves as expected, exactly like the first test.

I took note of your remark about TreeItem.imgSrc possibly being called 
without a Tree object and traced the calls back to 
TreeItem.updateState(). In the else: clause in that method imgSrc is 
called twice for tree_closed.gif without a Tree object (presumably, once 
for each branch. It seemed to me that these calls were probably 
unnecessary and also likely to fail, so I inserted a test for the tree 
object and continued only if the object existed. Somewhere around line 
331 of TreeItem.py.
             if self.tree:
                  DOM.setAttribute(self.imgElem, "src", 
self.imgSrc("tree_closed.gif"))


Third Test: exactly as first test except imgSrc not called on 
tree_closed.gif if not self.tree
Server Output:
Deborah - - [26/Apr/2012 5:11:10] "GET /public/index.html HTTP/1.1" 200 -

No HTTP for images! The application again behaves as it should.

Conclusion: The HTTP GETs for the images are caused by calling 
TreeItem.imgSrc without a Tree object and are unnecessary. Probably 
TreeItem.updateState() should test for valid Tree object in all its 
branches because different initial tree structures might hit different 
branches before the Tree is constructed.

It would be very interesting to hear whether doing that modification to 
TreeItem.updateState() will fix the problem for you too.

Phil

Reply via email to