vanschelven/epiwork-website — Issue #14: Reloading the neighbourhood map after logging out triggers an error
Author: vanschelven
Created: 2011-12-01 14:10:13+00:00
State: open
Labels: bug, nice-to-have

When revisiting particular pages as a non-logged-in user the following error is triggered:

Traceback (most recent call last):

File "/home/ppcommon/virtualenvs/2/lib/python2.7/site-packages/django/core/handlers/base.py", line 111, in get_response
response = callback(request, *callback_args, **callback_kwargs)

File "/home/ggm/changesets/production/apps/pollster/views.py", line 368, in chart_data
survey_user = _get_active_survey_user(request)

File "/home/ggm/changesets/production/apps/pollster/views.py", line 439, in _get_active_survey_user
return SurveyUser.objects.get(global_id=gid, user=request.user)

File "/home/ppcommon/virtualenvs/2/lib/python2.7/site-packages/django/db/models/manager.py", line 132, in get
return self.get_query_set().get(*args, **kwargs)

File "/home/ppcommon/virtualenvs/2/lib/python2.7/site-packages/django/db/models/query.py", line 341, in get
clone = self.filter(*args, **kwargs)

File "/home/ppcommon/virtualenvs/2/lib/python2.7/site-packages/django/db/models/query.py", line 550, in filter
return self._filter_or_exclude(False, *args, **kwargs)

File "/home/ppcommon/virtualenvs/2/lib/python2.7/site-packages/django/db/models/query.py", line 568, in _filter_or_exclude
clone.query.add_q(Q(*args, **kwargs))

File "/home/ppcommon/virtualenvs/2/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1172, in add_q
can_reuse=used_aliases, force_having=force_having)

File "/home/ppcommon/virtualenvs/2/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1107, in add_filter
connector)

File "/home/ppcommon/virtualenvs/2/lib/python2.7/site-packages/django/db/models/sql/where.py", line 67, in add
value = obj.prepare(lookup_type, value)

File "/home/ppcommon/virtualenvs/2/lib/python2.7/site-packages/django/db/models/sql/where.py", line 316, in prepare
return self.field.get_prep_lookup(lookup_type, value)

File "/home/ppcommon/virtualenvs/2/lib/python2.7/site-packages/django/db/models/fields/related.py", line 136, in get_prep_lookup
return self._pk_trace(value, 'get_prep_lookup', lookup_type)

File "/home/ppcommon/virtualenvs/2/lib/python2.7/site-packages/django/db/models/fields/related.py", line 209, in _pk_trace
v = getattr(field, prep_func)(lookup_type, v, **kwargs)

File "/home/ppcommon/virtualenvs/2/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 292, in get_prep_lookup
return self.get_prep_value(value)

File "/home/ppcommon/virtualenvs/2/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 479, in get_prep_value
return int(value)

TypeError: int() argument must be a string or a number, not 'AnonymousUser'

,
POST:,
COOKIES:{'__utmc': '1', 'django_language': 'nl'},
META:{'CSRF_COOKIE': 'b88e1210bee2f18f804512455dca2730',
'DOCUMENT_ROOT': '/etc/apache2/htdocs',
'GATEWAY_INTERFACE': 'CGI/1.1',
'HTTPS': '1',
'HTTP_ACCEPT': 'application/json, text/javascript, */*; q=0.01',
'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
'HTTP_ACCEPT_LANGUAGE': 'nl',
'HTTP_CONNECTION': 'Keep-Alive',
'HTTP_COOKIE': 'django_language=nl; __utmc=1',
'HTTP_HOST': 'www.degrotegriepmeting.nl',
'HTTP_REFERER': 'https://www.degrotegriepmeting.nl/nl/survey/thanks/?gid=xxx',
'HTTP_USER_AGENT': 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB7.2; .NET CLR 1.1.4322; InfoPath.1)',
'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest',
'PATH_INFO': u'/surveys/weekly/charts/neighbourhood.json',
'PATH_TRANSLATED': '/home/ggm/wsgi/django_wsgi.py/surveys/weekly/charts/neighbourhood.json',
'QUERY_STRING': 'gid=xxx',
'REMOTE_ADDR': 'xx.xx.xx.xx',
'REMOTE_PORT': '1205',
'REQUEST_METHOD': 'GET',
'REQUEST_URI': '/surveys/weekly/charts/neighbourhood.json?gid=xxx',
'SCRIPT_FILENAME': '/home/ggm/wsgi/django_wsgi.py',
'SCRIPT_NAME': u'',
'SERVER_ADDR': '176.9.42.170',
'SERVER_ADMIN': '[no address given]',
'SERVER_NAME': 'www.degrotegriepmeting.nl',
'SERVER_PORT': '443',
'SERVER_PROTOCOL': 'HTTP/1.1',
'SERVER_SIGNATURE': '

Apache/2.2.17 (Ubuntu) Server at www.degrotegriepmeting.nl Port 443

\n',
'SERVER_SOFTWARE': 'Apache/2.2.17 (Ubuntu)',
'mod_wsgi.application_group': 'www.degrotegriepmeting.nl|',
'mod_wsgi.callable_object': 'application',
'mod_wsgi.handler_script': '',
'mod_wsgi.input_chunked': '0',
'mod_wsgi.listener_host': '',
'mod_wsgi.listener_port': '443',
'mod_wsgi.process_group': 'ggm',
'mod_wsgi.request_handler': 'wsgi-script',
'mod_wsgi.script_reloading': '1',
'mod_wsgi.version': (3, 3),
'nokeepalive': '1',
'ssl-unclean-shutdown': '1',
'wsgi.errors': ,
'wsgi.file_wrapper': ,
'wsgi.input': ,
'wsgi.multiprocess': True,
'wsgi.multithread': False,
'wsgi.run_once': False,
'wsgi.url_scheme': 'https',
'wsgi.version': (1, 1)}>