Whoops, it was the first suspect, which for some reason I talked myself out of. You're using an htmltext instance as a key, rather than a string. They aren't subscriptable, and it needs to be, in order for the lookup of 'referer' to succeed. It isn't really in the dict, it just let's you think it is by converting it to the 'HTML_REFERER' that might be in the dict. try this in your ptl based [html] functions instead: request.get_header(str('referer')) and you'll get the right result. Jason > 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') >