I am building an online test taking type of application and I am having an issue with one of my session variables...
The code looks something like this: (A lot removed for brevity) The first time around I do the following to initialize the list: question = Question.objects.order_by('?')[0] # Get a random question request.session['question_list'] = [int(question.id),] Then on the second pass, I do the following: questions_asked = request.session['question_list'] question = Question.objects.order_by('?')[0] # Get a random question request.session['question_list'] = questions_asked.append(int(question.id)) Now this partially works. The first page of my test asks how many questions you want and then once that is entered, it takes you to the first question. My debugging output shows that I do indeed have a list with the current question's ID in it. I answer the question, it takes me to page 2. Now my debugging information shows I have two ids in my list, the first question and this second question. Now, when I answer this second question, I get: AttributeError at /flight/test/ 'NoneType' object has no attribute 'append' Here is the traceback info: Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py" in get_response 77. response = callback(request, *callback_args, **callback_kwargs) File "/var/www/localhost/django/flight_school/knowledge_test/views.py" in take_test 42. request.session['question_list'] = questions_asked.append(int(question.id)) AttributeError at /flight/test/ 'NoneType' object has no attribute 'append' If I change the line that appends it to the following: try: request.session['question_list'] = questions_asked.append(int(question.id)) except AttributeError: request.session['question_list'] = [question.id,] Again, the first two are ok, the third shows the request.session['question_list'] contains 'None' The next question show the previous question and the current question. Then none, then previous question and the current question, etc.... This is with the 0.96 version. Am I doing something wrong? Should I try to upgrade to the svn version? I am using this with apache/ mod_python but the same thing happens with the development server. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---