bottlepy / bottle

bottle.py is a fast and simple micro-framework for python web-applications.
http://bottlepy.org/
MIT License
8.44k stars 1.47k forks source link

AttributeError: 'LocalRequest' object has no attribute 'header' #276

Closed mwebber closed 12 years ago

mwebber commented 12 years ago

( I posted this to the bottlepy Google Group last week, but it's still waiting for a moderator to OK it).

I have been running successfully with bottle 0.9.6. I recently upgraded to 0.10.7, and now my application is failing with:

Traceback (most recent call last): File "/dls_sw/apps/DataDispenser/python/ws043/lib/python2.7/site- packages/bottle.py", line 737, in _handle return route.call(*_args) File "/dls_sw/apps/DataDispenser/python/ws043/lib/python2.7/site- packages/bottle.py", line 1456, in wrapper rv = callback(_a, **ka) File "/dls_sw/apps/DataDispenser/dev/webinterface.py", line 267, in login destination_url = bottle.request.header.get('Referer', '/').strip() AttributeError: 'LocalRequest' object has no attribute 'header'

The changelog indicates that there have been some changes in this area in 0.10, but looking at the docs, I think bottle.request.header should still exist.

Is there a change I need to make to my code?

Thanks

defnull commented 12 years ago

Am 31.01.2012 19:58, schrieb Matthew Webber:

I have been running successfully with bottle 0.9.6. I recently upgraded to 0.10.7, and now my application is failing with:

AttributeError: 'LocalRequest' object has no attribute 'header'

The changelog indicates that there have been some changes in this area in 0.10, but looking at the docs, I think bottle.request.header should still exist.

Really? I'll search the docs for wrong examples. I thought I fixed them already.

Is there a change I need to make to my code?

Response.header was renamed to Response.headers in Bottle 0.8. In 0.9 you should see a lot of DeprecationWarnings. Backwards compatibility ended with 0.10.

mwebber commented 12 years ago

Completely my fault - I didn't note the plural form, and for some reason DeprecationWarnings were not seen. Thanks

mwebber commented 12 years ago

header --> headers applies to both response and request