But the error is actually caused by request.get_header('referer'), it was there even if i removed the redirect statement According to the doc string, request.get_header('referer') is equal to request.get_header('HTTP_REFERER') On Sat, 28 Aug 2004 16:17:54 -0500, Jason E. Sibrewrote: > Um... Not sure if I'm on the right track or not, but could it be that the > header 'referer' does not exist, and the 'unsubscriptable object' to which > the TypeError refers is the None that is being returned from > .get_header('referer')? > > A look at the code does indicate that if "HTTP_REFERER" exists, "referer" > should also [appear to] exist. However, and my apologies if I'm stating the > obvious, the referer header is not always there; it's only there if the > client (browser, usually) provides it. Typically, if the person using the > browser accesses a URL by typing it into the address bar, or using a > Favorite/Bookmark, that header won't be sent. It will be present (again > assuming the client is working right) if the person gets there via a link, > or a form submission. I don't know how browsers handle that header in the > context of a redirect (Does it re-provide the Referer it sent when it > received the redirect? Does it provide the url that resulted in a redirect? > Does it provide nothing? I don't know). > > Either way, I would definitely check the result of your call to > request.get_header('referer') or request.get_header('HTTP_REFERER') to be > sure you get a string back, because you just can't safely expect it to be > there, and .redirect() doesn't like non-strings. :) > > Jason > > > > > > -----Original Message----- > > From: quixote-users-bounces@mems-exchange.org > > [mailto:quixote-users-bounces@mems-exchange.org]On Behalf Of Bruce Wang > > Sent: Saturday, August 28, 2004 12:09 AM > > To: quixote-users@mems-exchange.org > > Subject: [Quixote-users] wierd TypeError caused by > > http_request.get_header > > > > > > I was trying to redirect back to referer in a ptl, then got a TypeError > > When I change it to "request.get_header("HTTP_REFERER") ", > > everything is fine > > > > Any idea? > > > > > > Traceback (most recent call last): > > File "/usr/lib/python2.3/site-packages/quixote/publish.py", line > > 522, in process_request > > File "/usr/lib/python2.3/site-packages/quixote/publish.py", line > > 457, in try_publish > > File "/home/bruce/sandbox/falco/ui/results_ui.ptl", line 33, in first > > return request.redirect(request.get_header('referer')) > > File "/usr/lib/python2.3/site-packages/quixote/http_request.py", > > line 181, in get_header > > TypeError: unsubscriptable object > > > > > > -- > > simple is good > > _______________________________________________ > > Quixote-users mailing list > > Quixote-users@mems-exchange.org > > http://mail.mems-exchange.org/mailman/listinfo/quixote-users > > > > -- simple is good