On Sat, 05 Nov 2005 03:04:27 -0800 PythonistL wrote:

> 
> I use the following view for user's log in
> ###################
> def MyLogin(request):
>     WrongID=0
>     AllGood=1
>     if request.POST:
>         print "Refferer1 from POST",Refferer1

At this point, you haven't yet set Referrer1, so it will throw an
exception.  I've tested it and request.META['HTTP_REFERER'] always does
have the referer as it ought, but if there is no referer header it will
throw a KeyError, so you need to do something like this:

referer = request.META.get('HTTP_REFERER', None)

You should also note that the header can be forged, and some people
have it turned off for privacy reasons, so I wouldn't rely on it being
there.  It is not reliably present, and not reliable if present.

Luke


-- 
"I regret I wasn't born with opposable toes." (Calvin and Hobbes)

Luke Plant || L.Plant.98 (at) cantab.net || http://lukeplant.me.uk/

Reply via email to