G:\do\alldo\autopart007\web>python code.py
Traceback (most recent call last):
File "code.py", line 4, in <module>
from controllers import admin, people
File "G:\do\alldo\autopart007\web\controllers\people.py", line 3, in <module>
import web, md5, settings
File "G:\do\alldo\autopart007\web\settings.py", line 7, in <module>
refer = web.ctx.env["HTTP_REFERER"]
File "D:\Python\lib\site-packages\web\utils.py", line 830, in __getattr__
return getattr(self._getd(), key)
File "D:\Python\lib\site-packages\web\utils.py", line 64, in __getattr__
raise AttributeError, k
AttributeError: 'env'
The headers argument specifies HTTP headers as a mapping object
such as a dict.
>>> urls = ('/ua', 'uaprinter')
>>> class uaprinter:
... def GET(self):
... return 'your user-agent is ' + web.ctx.env['HTTP_USER_AGENT']
...
web.ctx.env is available only when handling requests. Looks like you
are using it when initializing the application.
web.ctx.env is available only when handling requests. Looks like you
are using it when initializing the application.
You can directltt use web.ctx.HTTP_REFERRER wherever needed.
But if you want to use if only from setttings.py then write a function
that returns that
in settings.py:
def referrer():
return web.ctx.HTTP_REFERRER
and use
settings.referrer()