seb bacon wrote:
* Steve Alexander <steve@cat-box.net> [010711 07:59]:
KeyError: SERVER_URL
I have seen a similar traceback which was due to a bug in CopyPaste.py, to which I have submitted a patch. It had to do with a lack of an acquisition wrapper at an inopportune time. It looks as though absolute_url() is being called without a proper wrapper around the object it is begin called for.
Looks to me like absolute_url() is being called when absolute_url(1) should be used.
I didn't know about the absolute_url(relative=1) switch. Do virtually hosted envirnoments not have a SERVER_URL variable?
This actually points to a lack of an acquireable REQUEST object. If you look at the code in absolute_url, it tries to acquire REQUEST and if it can't, it sets it to {}. Then when it does a REQUEST['SERVER_URL'] later on it gets a KeyError. I personally think this code is very brittle, but it does work 99.99% of the time.
However, I don't think this is the problem.
(1) I'm not in a virtual hosting scenario (2) it happens at fairly random intervals *on the same page*.
This is very weird. I would expect it to act consistently. I hate that!
I can be working on a page, then reload it, and I get the KeyError. Then I can reload it again and the error goes. Then I go back to it, reload it again, and the error appears. Reload it again and the error remains. Reload it again and it disappears again... You get the idea.
Is it truely random or an every-other reload sort of regularity? I have a feeling you'll pick the former.
This makes it very difficult to debug. I left my computer on overnight, without changing any app settings, and haven't seen the error yet today.
My feeling is that Casey's right. It's happening on a CMF object to which I've added BeforeTraverse hooks, which could possibly have something to do with it.
Can you experiment with removing/changing these hooks? Can you post the code for your object?
However, I've actually seen this problem before, about a year ago, with a completely unrelated ZClass-based objects. I remember then noticing that the error occured more often with Netscape and Opera than IE. Of course, that theory is utter nonsense seeing as HTTP is a connectionless protocol and the headers each browser sends are effectively the same. However, in the absence of a reproduceable error, I have to clutch at straws ;-)
seb
The browser differences may point to caching differences that make it seem as though it is working. Any DCians have any insights? -- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------>