apache - Django (mod_wsgi) - HttpBasicAuthentication using view decorator - AttributeError -


i'm writing small app. wish use view decorator found. here the snippet, , a post describing usage. have apache server (2.2) running, , django up-to-date. i've decorated view, , when trying it, attributeerror occurs:

request method: 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 @ /redb/test/ exception value: 'function' object has no attribute 'status_code' 

this how i'm using it:

@logged_in_or_basicauth def test_handler(request):     return httpresponse("test!") 

thanks!

the decorator takes argument, must call decorator, if not provide argument realm , let default "".

@logged_in_or_basicauth() def test_handler(request):     return httpresponse("test!") 

Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -