On 9/25/13 10:26 AM, John Gordon wrote:
There's no need for the "except KeyError" clause. dict.get never raises KeyError, this code will assign 'UnknownRef' in the case the environment variable is missing.You could try this:try: referer = os.environ.get('HTTP_REFERER', 'UnknownRef') except KeyError: referer = None if not referer: referer = 'UnknownRef'
--Ned. -- https://mail.python.org/mailman/listinfo/python-list