I'm writing a small app. I wish to use a view decorator I found. This here is the snippet, and this is a post describing its usage. I have an Apache server (2.2) running, and Django is up-to-date. I've decorated a view, and when trying to GET it, an AttributeError occurs:
Request Method: GET
Request URL: http://localhost/redb/test/
Django Version: 1.5.1
Python Version: 2.7.5
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'django.contrib.admindocs',
'redb_app')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')
Traceback:
File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in get_response
187. response = middleware_method(request, response)
File "C:\Python27\lib\site-packages\django\middleware\common.py" in process_response
109. if response.status_code == 404:
Exception Type: AttributeError at /redb/test/
Exception Value: 'function' object has no attribute 'status_code'
This is how I'm using it:
@logged_in_or_basicauth
def test_handler(request):
return HttpResponse("Test!")
Thanks!