[albatross-users] Re: pre4 - Problems still ...

Dave Cole djc at object-craft.com.au
Wed Jul 16 09:42:13 EST 2003


>>>>> "Sheila" == Sheila King <sheila at thinkspot.net> writes:

>> It looks like you have some <al-img> tags somewhere (haven't looked
>> at the source yet) because I can see requests like this:
>> 
>> GET http://mathxy.com/cgi-bin/test/mgr.py/spacer.gif
>> 
>> This is followed by a traceback response which you do not see
>> because the browser thinks it should be getting an image.
>> 
>> After the traceback Albatross deletes the session, so you get
>> dropped back to a session expired state.

Sheila> There is definitely something different about the error
Sheila> handling in pre4 as opposed to previous versions of Albatross.

I am interested to know what you see as being the difference.

Sheila> The error you mention above is essentially a 404 error. There
Sheila> was no al-img tag, but my commonmacros.html file did have a
Sheila> normal HTML <img> tag and the image refereced was not on the
Sheila> server, and so should generate a 404 error.

Another way that you might see the browser requesting the image from
the application via http://mathxy.com/cgi-bin/test/mgr.py/spacer.gif
is if you put a plain IMG tag in your template like this:

        <img src="spacer.gif">

The browser will treat this as a relative URL and will expand it to a
full URL. 

Just looked at your code.  commonmacros.html has this:

        <img src="spacer.gif" width="600" height="1" vspace="0" hspace="0">

Sheila> However, it has apparently been like that for a long time
Sheila> (this image is also called in my full application program) and
Sheila> has never caused session to drop before.

Sheila> Maybe it should cause session to drop. Dunno.

Your application does not recognise the request for the image and
treat it as such - it responds with a python traceback.

Sheila> But, even if I fix that problem, there are other errors I've
Sheila> found, such as expressions not being defined in the local
Sheila> context name space. Before these always took me to the default
Sheila> Albatross error page (which I've not tried to overwrite) with
Sheila> a nice traceback. When this happened, I KNEW that something in
Sheila> my code was wrong.

Did you manage to see the content being returned for the image
requests?  They certainly looked like a normal Albatross traceback to
me.  I did not look at the content of the traceback.

Sheila> Now it is not doing that. It is taking me to the expired
Sheila> session page in my application and the only way I can see the
Sheila> tracebacks for anything (it seems) is by sniffing packets.

This is not so much a problem of Albatross.  The browser requests some
image data and receives some text in response.  It handles this by
silently discarding the data from what I can see.

Sheila> I'm not a neophyte cgi programmer, although I'm no expert
Sheila> either. But I have a fair/modest amount of experience in this
Sheila> area, and I've never had to sniff packets before to read the
Sheila> error messages sent by a Python cgi script.

You don't have to sniff packets - I just do it sometimes when I do not
want to modify the source.  Given that not all of what happens between
the browser and application is visible, packet sniffing is a useful
tool at times.

Sheila> Is this again something peculiar to the redirect/random URL
Sheila> type of applications?

Nope.  If you cause the browser to request an image of an application
that is not prepared to serve images then you will not get good
results.

Sheila> It looks to me like this new send_redirect function could be
Sheila> the culprit?  Or is at least involved in some way?

Shiela>     def send_redirect(self, loc):
Shiela>         cookie = self.get_header('Set-Cookie')
Shiela>         if cookie:
Shiela>             self.request.write_header('Set-Cookie', cookie)
Shiela>         return self.request.redirect(loc) 

I would be a little surprised if it was having any impact on the
problem.

Sheila> Could this be the reason that after the handle_exception
Sheila> method prints out the traceback, that the request is still
Sheila> redirected to the previously requested redirect page? If so,
Sheila> IMO this behavior should be modified.  handle_exception should
Sheila> print the output (traceback) and then halt.

The redirect is caused by the Location header, not the Set-Cookie.

Sheila> I'm just grasping about to try and think why it is so flipping
Sheila> hard for me to see that there are errors in my code, when with
Sheila> previous versions of Albatross it was easy.

I am a bit confused about this.  I cannot see how the 1.10pre4 release
is different to previous releases in how it handles and reports
errors.  That does not mean that there are no differences, it just
means I don't think anything that has changed to impact that
behaviour.

- Dave

-- 
http://www.object-craft.com.au




More information about the Albatross-users mailing list