I'm reading the documentation on sessions (http://
docs.djangoproject.com/en/dev/topics/http/sessions/?from=olddocs) and
saw the following example:
def post_comment(request, new_comment):
if request.session.get('has_commented', False):
return HttpResponse("You've already commented.")
c = comments.Comment(comment=new_comment)
c.save()
request.session['has_commented'] = True
return HttpResponse('Thanks for your comment!')
"request" seems to be a local variable, so I would think that setting
request.session['has_commented'] = True
would have no effect, since that variable is not used again (e.g. not
returned by the function). Does assigning a value in the
request.session dictionary somehow send a cookie to the user's
browser? I tested whether I could store a value in request.session in
one view function and retrieve it in a subsequent view function, and
that didn't work for me, as I had expected. Could somebody shed some
light on this?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---