Tuesday, September 6, 2011

Session value persistence between views

Hi:
I am very new to Django but I am trying to authenticate using Django's
session framework.
Problem is: I need the raw password to ssh as that user to retrieve
data on another machine. I haven't gotten it to work however.

I have a login view that looks like:

def login(request):
request.session['blah']=request.POST['username']
request.session['blah2']=request.POST['password']

<snip>

def view_data(request):
username=request.session['blah']
password=request.session['blah2']
<snip>

I get KeyError with view_data. Am I missing something here? I thought
the session data you assign persists between views. I can verify that
the cookie is stored with the sessionid, which would indicate to me
that I've changed session data.

Thanks.

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment