Pylons routing environ

引数としてenvironの変数を渡す

http://pylonsbook.com/en/1.1/urls-routing-and-dispatch.html#conditions

def referals(environ, result):
    result['referer'] = environ.get('HTTP_REFERER')
    return True

You could use this function in a route like this to add the referrer to the matched routing variables:

map.connect('/{controller}/{action}/{id}', conditions=dict(function=referals))