Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why am I getting this error, "'NoneType' object has no attribute 'csrf_exempt'?

I am attempting to invoke /save_calendar, mapped to pim_calendar.save_calendar(), which begins:

@csrf_exempt
@login_required
def save_calendar(request):
    functions.ensure_profile_exists(request.user)
    now = time.localtime(time.time())
    if request.POST.has_key('description') and request.POST['description']:
        description = request.POST['description']
    else:
        description = 'Unspecified event'
   ...

The error is posted below, and this is the only @csrf_exempt function at present (although others may follow suit).

How am I passing a NoneType to the csrf_exempt decorator?

AttributeError at /save_calendar
'NoneType' object has no attribute 'csrf_exempt'
Request Method: POST
Request URL:    http://localhost:8000/save_calendar
Django Version: 1.3.1
Exception Type: AttributeError
Exception Value:    
'NoneType' object has no attribute 'csrf_exempt'
Exception Location: /usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/views/decorators/csrf.py in wrapped_view, line 40
Python Executable:  /usr/local/bin/python
Python Version: 2.7.0
Python Path:    
['/Users/jonathan/pim',
 '/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg',
 '/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/pip-0.8.1-py2.7.egg',
 '/usr/local/Cellar/python/2.7/lib/python27.zip',
 '/usr/local/Cellar/python/2.7/lib/python2.7',
 '/usr/local/Cellar/python/2.7/lib/python2.7/plat-darwin',
 '/usr/local/Cellar/python/2.7/lib/python2.7/plat-mac',
 '/usr/local/Cellar/python/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
 '/usr/local/Cellar/python/2.7/lib/python2.7/lib-tk',
 '/usr/local/Cellar/python/2.7/lib/python2.7/lib-old',
 '/usr/local/Cellar/python/2.7/lib/python2.7/lib-dynload',
 '/usr/local/Cellar/python/2.7/lib/python2.7/site-packages',
 '/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/PIL',
 '/usr/local/lib/python2.7/site-packages',
 '/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info']
Server time:    Fri, 17 Feb 2012 13:05:05 -0600
Traceback Switch to copy-and-paste view

/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/core/handlers/base.py in get_response
                    for middleware_method in self._view_middleware:
                        response = middleware_method(request, callback, callback_args, callback_kwargs)
                        if response:
                            break
                if response is None:
                    try:
                        response = callback(request, *callback_args, **callback_kwargs) ...
                    except Exception, e:
                        # If the view raised an exception, run it through exception
                        # middleware, and if the exception middleware returns a
                        # response, use that. Otherwise, reraise the exception.
                        for middleware_method in self._exception_middleware:
                            response = middleware_method(request, e)
▶ Local vars
Variable    Value
exceptions  

e   
AttributeError("'NoneType' object has no attribute 'csrf_exempt'",)
callback_args   
()
receivers   
[(, None)]
middleware_method   
>
self    

settings    

request 
,
POST:,
COOKIES:{'csrftoken': 'a4bad057271d130082f6f30c6ae39697',
 'sessionid': 'a25c3081a67d1968e9fc760f4e7048de'},
META:{'Apple_PubSub_Socket_Render': '/tmp/launch-VcFoHA/Render',
 'Apple_Ubiquity_Message': '/tmp/launch-8KfrWM/Apple_Ubiquity_Message',
 'COMMAND_MODE': 'unix2003',
 'CONTENT_LENGTH': '50',
 'CONTENT_TYPE': 'application/x-www-form-urlencoded',
 'CSRF_COOKIE': 'a4bad057271d130082f6f30c6ae39697',
 'DISPLAY': '/tmp/launch-Q2SUMz/org.x:0',
 'DJANGO_SETTINGS_MODULE': 'pim.settings',
 'GATEWAY_INTERFACE': 'CGI/1.1',
 'HOME': '/Users/jonathan',
 'HTTP_ACCEPT': '*/*',
 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
 'HTTP_ACCEPT_ENCODING': 'gzip,deflate,sdch',
 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.8',
 'HTTP_CONNECTION': 'keep-alive',
 'HTTP_COOKIE': 'csrftoken=a4bad057271d130082f6f30c6ae39697; sessionid=a25c3081a67d1968e9fc760f4e7048de',
 'HTTP_HOST': 'localhost:8000',
 'HTTP_ORIGIN': 'http://localhost:8000',
 'HTTP_REFERER': 'http://localhost:8000/',
 'HTTP_USER_AGENT': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.46 Safari/535.11',
 'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest',
 'LANG': 'en_US.UTF-8',
 'LOGNAME': 'jonathan',
 'OLDPWD': '/Users/jonathan/pim/accounts',
 'PATH': '/Users/jonathan/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin',
 'PATH_INFO': u'/save_calendar',
 'PWD': '/Users/jonathan/pim',
 'PYTHON_PATH': '/usr/local/Cellar/python/2.7/lib/python2.7/site-packages:/usr/local/Cellar',
 'QUERY_STRING': '',
 'REMOTE_ADDR': '127.0.0.1',
 'REMOTE_HOST': '',
 'REQUEST_METHOD': 'POST',
 'RUN_MAIN': 'true',
 'SCRIPT_NAME': u'',
 'SECURITYSESSIONID': '186a5',
 'SERVER_NAME': '1.0.0.127.in-addr.arpa',
 'SERVER_PORT': '8000',
 'SERVER_PROTOCOL': 'HTTP/1.1',
 'SERVER_SOFTWARE': 'WSGIServer/0.1 Python/2.7',
 'SHELL': '/bin/bash',
 'SHLVL': '1',
 'SSH_AUTH_SOCK': '/tmp/launch-KCcDNI/Listeners',
 'TERM': 'xterm-256color',
 'TERM_PROGRAM': 'Apple_Terminal',
 'TERM_PROGRAM_VERSION': '303',
 'TERM_SESSION_ID': '821787AF-B996-4691-BE4F-87C8BEEECE48',
 'TMPDIR': '/var/folders/_2/fbtyy5751sg2b_5frn86qls00000gq/T/',
 'TZ': 'America/Chicago',
 'USER': 'jonathan',
 '_': '/usr/local/bin/python',
 '__CF_USER_TEXT_ENCODING': '0x1F7:0:0',
 'wsgi.errors': ', mode 'w' at 0x100556270>,
 'wsgi.file_wrapper': ,
 'wsgi.input': ,
 'wsgi.multiprocess': False,
 'wsgi.multithread': True,
 'wsgi.run_once': False,
 'wsgi.url_scheme': 'http',
 'wsgi.version': (1, 0)}>
callback    

resolver    

urlresolvers    

callback_kwargs 
{}
response    
None
urlconf 
'pim.urls'
/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/contrib/auth/decorators.py in _wrapped_view
    that takes the user object and returns True if the user passes.
    """
    def decorator(view_func):
        @wraps(view_func, assigned=available_attrs(view_func))
        def _wrapped_view(request, *args, **kwargs):
            if test_func(request.user):
                return view_func(request, *args, **kwargs) ...
            path = request.build_absolute_uri()
            # If the login url is the same scheme and net location then just
            # use the path as the "next" url.
            login_scheme, login_netloc = urlparse.urlparse(login_url or
                                                        settings.LOGIN_URL)[:2]
            current_scheme, current_netloc = urlparse.urlparse(path)[:2]
▶ Local vars
Variable    Value
test_func   
 at 0x102303e60>
login_url   
None
args    
()
request 
,
POST:,
COOKIES:{'csrftoken': 'a4bad057271d130082f6f30c6ae39697',
 'sessionid': 'a25c3081a67d1968e9fc760f4e7048de'},
META:{'Apple_PubSub_Socket_Render': '/tmp/launch-VcFoHA/Render',
 'Apple_Ubiquity_Message': '/tmp/launch-8KfrWM/Apple_Ubiquity_Message',
 'COMMAND_MODE': 'unix2003',
 'CONTENT_LENGTH': '50',
 'CONTENT_TYPE': 'application/x-www-form-urlencoded',
 'CSRF_COOKIE': 'a4bad057271d130082f6f30c6ae39697',
 'DISPLAY': '/tmp/launch-Q2SUMz/org.x:0',
 'DJANGO_SETTINGS_MODULE': 'pim.settings',
 'GATEWAY_INTERFACE': 'CGI/1.1',
 'HOME': '/Users/jonathan',
 'HTTP_ACCEPT': '*/*',
 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
 'HTTP_ACCEPT_ENCODING': 'gzip,deflate,sdch',
 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.8',
 'HTTP_CONNECTION': 'keep-alive',
 'HTTP_COOKIE': 'csrftoken=a4bad057271d130082f6f30c6ae39697; sessionid=a25c3081a67d1968e9fc760f4e7048de',
 'HTTP_HOST': 'localhost:8000',
 'HTTP_ORIGIN': 'http://localhost:8000',
 'HTTP_REFERER': 'http://localhost:8000/',
 'HTTP_USER_AGENT': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.46 Safari/535.11',
 'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest',
 'LANG': 'en_US.UTF-8',
 'LOGNAME': 'jonathan',
 'OLDPWD': '/Users/jonathan/pim/accounts',
 'PATH': '/Users/jonathan/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin',
 'PATH_INFO': u'/save_calendar',
 'PWD': '/Users/jonathan/pim',
 'PYTHON_PATH': '/usr/local/Cellar/python/2.7/lib/python2.7/site-packages:/usr/local/Cellar',
 'QUERY_STRING': '',
 'REMOTE_ADDR': '127.0.0.1',
 'REMOTE_HOST': '',
 'REQUEST_METHOD': 'POST',
 'RUN_MAIN': 'true',
 'SCRIPT_NAME': u'',
 'SECURITYSESSIONID': '186a5',
 'SERVER_NAME': '1.0.0.127.in-addr.arpa',
 'SERVER_PORT': '8000',
 'SERVER_PROTOCOL': 'HTTP/1.1',
 'SERVER_SOFTWARE': 'WSGIServer/0.1 Python/2.7',
 'SHELL': '/bin/bash',
 'SHLVL': '1',
 'SSH_AUTH_SOCK': '/tmp/launch-KCcDNI/Listeners',
 'TERM': 'xterm-256color',
 'TERM_PROGRAM': 'Apple_Terminal',
 'TERM_PROGRAM_VERSION': '303',
 'TERM_SESSION_ID': '821787AF-B996-4691-BE4F-87C8BEEECE48',
 'TMPDIR': '/var/folders/_2/fbtyy5751sg2b_5frn86qls00000gq/T/',
 'TZ': 'America/Chicago',
 'USER': 'jonathan',
 '_': '/usr/local/bin/python',
 '__CF_USER_TEXT_ENCODING': '0x1F7:0:0',
 'wsgi.errors': ', mode 'w' at 0x100556270>,
 'wsgi.file_wrapper': ,
 'wsgi.input': ,
 'wsgi.multiprocess': False,
 'wsgi.multithread': True,
 'wsgi.run_once': False,
 'wsgi.url_scheme': 'http',
 'wsgi.version': (1, 0)}>
kwargs  
{}
redirect_field_name 
'next'
view_func   

/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/views/decorators/csrf.py in wrapped_view
def csrf_response_exempt(view_func):
    """
    Modifies a view function so that its response is exempt
    from the post-processing of the CSRF middleware.
    """
    def wrapped_view(*args, **kwargs):
        resp = view_func(*args, **kwargs)
        resp.csrf_exempt = True ...
        return resp
    return wraps(view_func, assigned=available_attrs(view_func))(wrapped_view)
def csrf_view_exempt(view_func):
    """
    Marks a view function as being exempt from CSRF view protection.
▶ Local vars
Variable    Value
resp    
None
args    
(,
POST:,
COOKIES:{'csrftoken': 'a4bad057271d130082f6f30c6ae39697',
 'sessionid': 'a25c3081a67d1968e9fc760f4e7048de'},
META:{'Apple_PubSub_Socket_Render': '/tmp/launch-VcFoHA/Render',
 'Apple_Ubiquity_Message': '/tmp/launch-8KfrWM/Apple_Ubiquity_Message',
 'COMMAND_MODE': 'unix2003',
 'CONTENT_LENGTH': '50',
 'CONTENT_TYPE': 'application/x-www-form-urlencoded',
 'CSRF_COOKIE': 'a4bad057271d130082f6f30c6ae39697',
 'DISPLAY': '/tmp/launch-Q2SUMz/org.x:0',
 'DJANGO_SETTINGS_MODULE': 'pim.settings',
 'GATEWAY_INTERFACE': 'CGI/1.1',
 'HOME': '/Users/jonathan',
 'HTTP_ACCEPT': '*/*',
 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
 'HTTP_ACCEPT_ENCODING': 'gzip,deflate,sdch',
 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.8',
 'HTTP_CONNECTION': 'keep-alive',
 'HTTP_COOKIE': 'csrftoken=a4bad057271d130082f6f30c6ae39697; sessionid=a25c3081a67d1968e9fc760f4e7048de',
 'HTTP_HOST': 'localhost:8000',
 'HTTP_ORIGIN': 'http://localhost:8000',
 'HTTP_REFERER': 'http://localhost:8000/',
 'HTTP_USER_AGENT': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.46 Safari/535.11',
 'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest',
 'LANG': 'en_US.UTF-8',
 'LOGNAME': 'jonathan',
 'OLDPWD': '/Users/jonathan/pim/accounts',
 'PATH': '/Users/jonathan/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin',
 'PATH_INFO': u'/save_calendar',
 'PWD': '/Users/jonathan/pim',
 'PYTHON_PATH': '/usr/local/Cellar/python/2.7/lib/python2.7/site-packages:/usr/local/Cellar',
 'QUERY_STRING': '',
 'REMOTE_ADDR': '127.0.0.1',
 'REMOTE_HOST': '',
 'REQUEST_METHOD': 'POST',
 'RUN_MAIN': 'true',
 'SCRIPT_NAME': u'',
 'SECURITYSESSIONID': '186a5',
 'SERVER_NAME': '1.0.0.127.in-addr.arpa',
 'SERVER_PORT': '8000',
 'SERVER_PROTOCOL': 'HTTP/1.1',
 'SERVER_SOFTWARE': 'WSGIServer/0.1 Python/2.7',
 'SHELL': '/bin/bash',
 'SHLVL': '1',
 'SSH_AUTH_SOCK': '/tmp/launch-KCcDNI/Listeners',
 'TERM': 'xterm-256color',
 'TERM_PROGRAM': 'Apple_Terminal',
 'TERM_PROGRAM_VERSION': '303',
 'TERM_SESSION_ID': '821787AF-B996-4691-BE4F-87C8BEEECE48',
 'TMPDIR': '/var/folders/_2/fbtyy5751sg2b_5frn86qls00000gq/T/',
 'TZ': 'America/Chicago',
 'USER': 'jonathan',
 '_': '/usr/local/bin/python',
 '__CF_USER_TEXT_ENCODING': '0x1F7:0:0',
 'wsgi.errors': ', mode 'w' at 0x100556270>,
 'wsgi.file_wrapper': ,
 'wsgi.input': ,
 'wsgi.multiprocess': False,
 'wsgi.multithread': True,
 'wsgi.run_once': False,
 'wsgi.url_scheme': 'http',
 'wsgi.version': (1, 0)}>,)
view_func   

kwargs  
{}



Request information

GET
No GET data
POST
Variable    Value
yearly  
u'on'
monthly 
u'on'
calendar    
u'true'
description 
u'hhh'
FILES
No FILES data
COOKIES
Variable    Value
csrftoken   
'a4bad057271d130082f6f30c6ae39697'
sessionid   
'a25c3081a67d1968e9fc760f4e7048de'
META
Variable    Value
RUN_MAIN    
'true'
HTTP_REFERER    
'http://localhost:8000/'
SERVER_PROTOCOL 
'HTTP/1.1'
SERVER_SOFTWARE 
'WSGIServer/0.1 Python/2.7'
TERM_PROGRAM_VERSION    
'303'
REQUEST_METHOD  
'POST'
LOGNAME 
'jonathan'
USER    
'jonathan'
HTTP_ORIGIN 
'http://localhost:8000'
PATH    
'/Users/jonathan/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin'
QUERY_STRING    
''
HOME    
'/Users/jonathan'
DISPLAY 
'/tmp/launch-Q2SUMz/org.x:0'
TERM_PROGRAM    
'Apple_Terminal'
LANG    
'en_US.UTF-8'
HTTP_ACCEPT_CHARSET 
'ISO-8859-1,utf-8;q=0.7,*;q=0.3'
TERM    
'xterm-256color'
SHELL   
'/bin/bash'
TZ  
'America/Chicago'
HTTP_COOKIE 
'csrftoken=a4bad057271d130082f6f30c6ae39697; sessionid=a25c3081a67d1968e9fc760f4e7048de'
SERVER_NAME 
'1.0.0.127.in-addr.arpa'
REMOTE_ADDR 
'127.0.0.1'
SHLVL   
'1'
SECURITYSESSIONID   
'186a5'
wsgi.url_scheme 
'http'
_   
'/usr/local/bin/python'
SERVER_PORT 
'8000'
PATH_INFO   
u'/save_calendar'
CONTENT_LENGTH  
'50'
TERM_SESSION_ID 
'821787AF-B996-4691-BE4F-87C8BEEECE48'
HTTP_X_REQUESTED_WITH   
'XMLHttpRequest'
SSH_AUTH_SOCK   
'/tmp/launch-KCcDNI/Listeners'
wsgi.input  

Apple_PubSub_Socket_Render  
'/tmp/launch-VcFoHA/Render'
HTTP_HOST   
'localhost:8000'
SCRIPT_NAME 
u''
wsgi.multithread    
True
HTTP_CONNECTION 
'keep-alive'
TMPDIR  
'/var/folders/_2/fbtyy5751sg2b_5frn86qls00000gq/T/'
HTTP_ACCEPT 
'*/*'
wsgi.version    
(1, 0)
HTTP_USER_AGENT 
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.46 Safari/535.11'
GATEWAY_INTERFACE   
'CGI/1.1'
wsgi.run_once   
False
CSRF_COOKIE 
'a4bad057271d130082f6f30c6ae39697'
OLDPWD  
'/Users/jonathan/pim/accounts'
wsgi.multiprocess   
False
HTTP_ACCEPT_LANGUAGE    
'en-US,en;q=0.8'
wsgi.errors 
', mode 'w' at 0x100556270>
__CF_USER_TEXT_ENCODING 
'0x1F7:0:0'
Apple_Ubiquity_Message  
'/tmp/launch-8KfrWM/Apple_Ubiquity_Message'
PWD 
'/Users/jonathan/pim'
PYTHON_PATH 
'/usr/local/Cellar/python/2.7/lib/python2.7/site-packages:/usr/local/Cellar'
DJANGO_SETTINGS_MODULE  
'pim.settings'
CONTENT_TYPE    
'application/x-www-form-urlencoded'
wsgi.file_wrapper   
''
REMOTE_HOST 
''
HTTP_ACCEPT_ENCODING    
'gzip,deflate,sdch'
COMMAND_MODE    
'unix2003'
Settings
Using settings module pim.settings
Setting Value
YEAR_MONTH_FORMAT   
'F Y'
USE_L10N    
True
USE_THOUSAND_SEPARATOR  
False
LANGUAGE_CODE   
'en-us'
ROOT_URLCONF    
'pim.urls'
MANAGERS    
()
DEFAULT_CHARSET 
'utf-8'
STATIC_ROOT 
'/Users/jonathan/pim/../pim/static/'
TEST_DATABASE_CHARSET   
None
MESSAGE_STORAGE 
'django.contrib.messages.storage.user_messages.LegacyFallbackStorage'
DATABASE_HOST   
''
IGNORABLE_404_STARTS    
('/cgi-bin/', '/_vti_bin', '/_vti_inf')
SEND_BROKEN_LINK_EMAILS 
False
URL_VALIDATOR_USER_AGENT    
'Django/1.3.1 (http://www.djangoproject.com)'
STATICFILES_FINDERS 
('django.contrib.staticfiles.finders.FileSystemFinder',
 'django.contrib.staticfiles.finders.AppDirectoriesFinder')
SESSION_COOKIE_DOMAIN   
None
SESSION_COOKIE_NAME 
'sessionid'
COMMENTS_MODERATORS_GROUP   
None
TIME_INPUT_FORMATS  
('%H:%M:%S', '%H:%M')
DATABASES   
{'default': {'ENGINE': 'django.db.backends.sqlite3',
             'HOST': '',
             'NAME': 'dev.db',
             'OPTIONS': {},
             'PASSWORD': '********************',
             'PORT': '',
             'TEST_CHARSET': None,
             'TEST_COLLATION': None,
             'TEST_MIRROR': None,
             'TEST_NAME': None,
             'TIME_ZONE': 'America/Chicago',
             'USER': ''}}
TEST_DATABASE_NAME  
None
FILE_UPLOAD_PERMISSIONS 
None
FILE_UPLOAD_HANDLERS    
('django.core.files.uploadhandler.MemoryFileUploadHandler',
 'django.core.files.uploadhandler.TemporaryFileUploadHandler')
DEFAULT_CONTENT_TYPE    
'text/html'
APPEND_SLASH    
True
FIRST_DAY_OF_WEEK   
0
DATABASE_ROUTERS    
[]
DIRNAME 
'/Users/jonathan/pim/../pim'
STATICFILES_STORAGE 
'django.contrib.staticfiles.storage.StaticFilesStorage'
CACHES  
{'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
             'LOCATION': ''}}
SERVER_EMAIL    
'root@localhost'
SESSION_COOKIE_PATH 
'/'
USE_X_FORWARDED_HOST    
False
IGNORABLE_404_ENDS  
('mail.pl', 'mailform.pl', 'mail.cgi', 'mailform.cgi', 'favicon.ico', '.php')
MIDDLEWARE_CLASSES  
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')
USE_I18N    
True
THOUSAND_SEPARATOR  
','
SECRET_KEY  
'********************'
LANGUAGE_COOKIE_NAME    
'django_language'
FILE_UPLOAD_TEMP_DIR    
None
TRANSACTIONS_MANAGED    
False
LOGGING_CONFIG  
'django.utils.log.dictConfig'
TEMPLATE_LOADERS    
('django.template.loaders.filesystem.Loader',
 'django.template.loaders.app_directories.Loader')
TEMPLATE_DEBUG  
True
AUTHENTICATION_BACKENDS 
('django.contrib.auth.backends.ModelBackend',)
TEST_DATABASE_COLLATION 
None
FORCE_SCRIPT_NAME   
None
CACHE_BACKEND   
'locmem://'
SESSION_COOKIE_SECURE   
False
CSRF_COOKIE_DOMAIN  
None
FILE_CHARSET    
'utf-8'
DEBUG   
True
SESSION_FILE_PATH   
None
DEFAULT_FILE_STORAGE    
'django.core.files.storage.FileSystemStorage'
INSTALLED_APPS  
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'pim',
 'pim_accounts',
 'pim_calendar',
 'pim_scratchpad']
LANGUAGES   
(('ar', 'Arabic'),
 ('az', 'Azerbaijani'),
 ('bg', 'Bulgarian'),
 ('bn', 'Bengali'),
 ('bs', 'Bosnian'),
 ('ca', 'Catalan'),
 ('cs', 'Czech'),
 ('cy', 'Welsh'),
 ('da', 'Danish'),
 ('de', 'German'),
 ('el', 'Greek'),
 ('en', 'English'),
 ('en-gb', 'British English'),
 ('es', 'Spanish'),
 ('es-ar', 'Argentinian Spanish'),
 ('es-mx', 'Mexican Spanish'),
 ('es-ni', 'Nicaraguan Spanish'),
 ('et', 'Estonian'),
 ('eu', 'Basque'),
 ('fa', 'Persian'),
 ('fi', 'Finnish'),
 ('fr', 'French'),
 ('fy-nl', 'Frisian'),
 ('ga', 'Irish'),
 ('gl', 'Galician'),
 ('he', 'Hebrew'),
 ('hi', 'Hindi'),
 ('hr', 'Croatian'),
 ('hu', 'Hungarian'),
 ('id', 'Indonesian'),
 ('is', 'Icelandic'),
 ('it', 'Italian'),
 ('ja', 'Japanese'),
 ('ka', 'Georgian'),
 ('km', 'Khmer'),
 ('kn', 'Kannada'),
 ('ko', 'Korean'),
 ('lt', 'Lithuanian'),
 ('lv', 'Latvian'),
 ('mk', 'Macedonian'),
 ('ml', 'Malayalam'),
 ('mn', 'Mongolian'),
 ('nl', 'Dutch'),
 ('no', 'Norwegian'),
 ('nb', 'Norwegian Bokmal'),
 ('nn', 'Norwegian Nynorsk'),
 ('pa', 'Punjabi'),
 ('pl', 'Polish'),
 ('pt', 'Portuguese'),
 ('pt-br', 'Brazilian Portuguese'),
 ('ro', 'Romanian'),
 ('ru', 'Russian'),
 ('sk', 'Slovak'),
 ('sl', 'Slovenian'),
 ('sq', 'Albanian'),
 ('sr', 'Serbian'),
 ('sr-latn', 'Serbian Latin'),
 ('sv', 'Swedish'),
 ('ta', 'Tamil'),
 ('te', 'Telugu'),
 ('th', 'Thai'),
 ('tr', 'Turkish'),
 ('uk', 'Ukrainian'),
 ('ur', 'Urdu'),
 ('vi', 'Vietnamese'),
 ('zh-cn', 'Simplified Chinese'),
 ('zh-tw', 'Traditional Chinese'))
DATABASE_ENGINE 
''
DATABASE_NAME   
''
COMMENTS_FIRST_FEW  
0
PREPEND_WWW 
False
AUTH_PROFILE_MODULE 
'pim_accounts.UserProfile'
SESSION_COOKIE_HTTPONLY 
False
DATABASE_PORT   
''
DEBUG_PROPAGATE_EXCEPTIONS  
False
MONTH_DAY_FORMAT    
'F j'
LOGIN_URL   
'/accounts/login/'
SESSION_EXPIRE_AT_BROWSER_CLOSE 
False
TIME_FORMAT 
'P'
DATE_INPUT_FORMATS  
('%Y-%m-%d',
 '%m/%d/%Y',
 '%m/%d/%y',
 '%b %d %Y',
 '%b %d, %Y',
 '%d %b %Y',
 '%d %b, %Y',
 '%B %d %Y',
 '%B %d, %Y',
 '%d %B %Y',
 '%d %B, %Y')
CSRF_COOKIE_NAME    
'csrftoken'
EMAIL_HOST_PASSWORD 
'********************'
PASSWORD_RESET_TIMEOUT_DAYS 
'********************'
CACHE_MIDDLEWARE_ALIAS  
'default'
SESSION_SAVE_EVERY_REQUEST  
False
ADMIN_MEDIA_PREFIX  
'/static/admin/'
NUMBER_GROUPING 
0
SESSION_ENGINE  
'django.contrib.sessions.backends.db'
CSRF_FAILURE_VIEW   
'django.views.csrf.csrf_failure'
COMMENTS_SKETCHY_USERS_GROUP    
None
LOGIN_REDIRECT_URL  
'/accounts/profile/'
LOGGING 
{'disable_existing_loggers': False,
 'handlers': {'mail_admins': {'class': 'django.utils.log.AdminEmailHandler',
                              'level': 'ERROR'}},
 'loggers': {'django.request': {'handlers': ['mail_admins'],
                                'level': 'ERROR',
                                'propagate': True}},
 'version': 1}
CACHE_MIDDLEWARE_KEY_PREFIX 
''
LOCALE_PATHS    
()
TEMPLATE_STRING_IF_INVALID  
''
COMMENTS_ALLOW_PROFANITIES  
False
LOGOUT_URL  
'/accounts/logout/'
EMAIL_USE_TLS   
False
TEMPLATE_DIRS   
('/Users/jonathan/pim/../pim/templates',)
FIXTURE_DIRS    
()
EMAIL_HOST  
'localhost'
DATE_FORMAT 
'N j, Y'
MEDIA_ROOT  
'/Users/jonathan/pim/../pim/media/'
ADMINS  
()
FORMAT_MODULE_PATH  
None
DEFAULT_FROM_EMAIL  
'webmaster@localhost'
STATICFILES_DIRS    
()
MEDIA_URL   
'/media/'
DATETIME_FORMAT 
'N j, Y, P'
EMAIL_SUBJECT_PREFIX    
'[Django] '
SITE_ID 
1
DISALLOWED_USER_AGENTS  
()
ALLOWED_INCLUDE_ROOTS   
()
DECIMAL_SEPARATOR   
'.'
SHORT_DATE_FORMAT   
'm/d/Y'
DATABASE_USER   
''
TEST_RUNNER 
'django.test.simple.DjangoTestSuiteRunner'
TIME_ZONE   
'America/Chicago'
FILE_UPLOAD_MAX_MEMORY_SIZE 
2621440
EMAIL_BACKEND   
'django.core.mail.backends.smtp.EmailBackend'
DEFAULT_TABLESPACE  
''
TEMPLATE_CONTEXT_PROCESSORS 
('django.contrib.auth.context_processors.auth',
 'django.core.context_processors.debug',
 'django.core.context_processors.i18n',
 'django.core.context_processors.media',
 'django.core.context_processors.static',
 'django.contrib.messages.context_processors.messages')
SESSION_COOKIE_AGE  
1209600
SETTINGS_MODULE 
'pim.settings'
USE_ETAGS   
False
LANGUAGES_BIDI  
('he', 'ar', 'fa')
DEFAULT_INDEX_TABLESPACE    
''
INTERNAL_IPS    
()
STATIC_URL  
'/static/'
EMAIL_PORT  
25
SHORT_DATETIME_FORMAT   
'm/d/Y P'
ABSOLUTE_URL_OVERRIDES  
{}
DATABASE_OPTIONS    
{}
CACHE_MIDDLEWARE_SECONDS    
600
BANNED_IPS  
()
DATETIME_INPUT_FORMATS  
('%Y-%m-%d %H:%M:%S',
 '%Y-%m-%d %H:%M',
 '%Y-%m-%d',
 '%m/%d/%Y %H:%M:%S',
 '%m/%d/%Y %H:%M',
 '%m/%d/%Y',
 '%m/%d/%y %H:%M:%S',
 '%m/%d/%y %H:%M',
 '%m/%d/%y')
DATABASE_PASSWORD   
'********************'
ADMIN_FOR   
()
COMMENTS_BANNED_USERS_GROUP 
None
EMAIL_HOST_USER 
''
PROFANITIES_LIST    
'********************'
You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 500 page.
like image 312
Christos Hayward Avatar asked Feb 17 '12 19:02

Christos Hayward


People also ask

How do I fix NoneType has no attribute?

The Python "AttributeError: 'NoneType' object has no attribute 'get'" occurs when we try to call the get() method on a None value, e.g. assignment from function that doesn't return anything. To solve the error, make sure to only call get() on dict objects.

How do I fix NoneType attribute error in Python?

The Python "AttributeError: 'NoneType' object has no attribute" occurs when we try to access an attribute on a None value, e.g. assignment from a function that doesn't return anything. To solve the error, correct the assignment before accessing the attribute.

Why do I get NoneType in Python?

The TypeError: 'NoneType' object is not iterable error is raised when you try to iterate over an object whose value is equal to None. To solve this error, make sure that any values that you try to iterate over have been assigned an iterable object, like a string or a list.

What does AttributeError NoneType object has no attribute sort mean?

You are getting AttributeError: 'NoneType' object has no attribute 'something' because NoneType means that instead of an instance of whatever Class or Object you think you're working with, you've actually got None. It means that an assignment or function call up above failed or returned an unexpected result.


1 Answers

Your save_calendar view function isn't returning anything, which in Python is the same as returning None. The decorator tries to set an attribute on the returned response, and None can't be modified that way.

like image 108
Ned Batchelder Avatar answered Oct 26 '22 21:10

Ned Batchelder