In <l1uqi7$qi5$1...@dont-email.me> =?UTF-8?B?zp3Or866zr/Pgg==?= 
<nikos.gr...@gmail.com> writes:

> referer = os.environ.get('HTTP_REFERER', 'UnknownRef')

> but that doesn't return anything either.

When you say it "doesn't return anything", what exactly do you mean?  Does
it return None?  Does it raise KeyError?  Something else?

In any case, I'm surprised that doesn't work.  That should be the correct
way to do it.

You could try this:

    try:
        referer = os.environ.get('HTTP_REFERER', 'UnknownRef')
    except KeyError:
        referer = None

    if not referer:
        referer = 'UnknownRef'

-- 
John Gordon                   A is for Amy, who fell down the stairs
gor...@panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to