Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Nov. 13, 2005 03:38:40

Bryan M.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

problem with sessions docs?


The example code for logging a user in here:http://www.djangoproject.com/documentation/sessions/is this:

def login(request):
u = users.get_object(username__exact=request.POST)
if u.check_password(request.POST):
request.session = u.id
return HttpResponse("You're logged in.")
else:
return HttpResponse("Your username and password didn't match.")

It doesn't work for me. I googled and found some code here:http://cvd.cidev.nl/wordpress/?p=245That basically makes one small change resulting in this:

def login(request):
u = users.get_object(username__exact=request.POST)
if u.check_password(request.POST):

# CHANGE: different key used:
request.session = u.id
return HttpResponse("You're logged in.")
else:
return HttpResponse("Your username and password didn't match.")

Which then works for me. Is this an error in the docs? Maybe I need to svn up?

Thanks,

Bryan

Offline

#2 Nov. 13, 2005 04:44:06

Adrian H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

problem with sessions docs?


On 11/12/05, Bryan Murdock <> wrote:
> The example code for logging a user in here:
>
>http://www.djangoproject.com/documentation/sessions/>
> It doesn't work for me. I googled and found some code here:
>
> Is this an error in the docs? Maybe I need to svn up?

Hey Bryan,

This technically isn't an error in the docs; it's just a bit
misleading. The "user" in that example wasn't intended to be the user
from the authentication framework -- it's just some generic concept of
"user."

I've changed the example to use "member" instead of "user," to
underscore the fact that it's some random concept of "member" -- not
the "users" from the authentication system.

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org

Offline

#3 Nov. 13, 2005 04:49:31

Bryan M.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

problem with sessions docs?


On 11/12/05, Adrian Holovaty <> wrote:
> Hey Bryan,
>
> This technically isn't an error in the docs; it's just a bit
> misleading. The "user" in that example wasn't intended to be the user
> from the authentication framework -- it's just some generic concept of
> "user."
>
> I've changed the example to use "member" instead of "user," to
> underscore the fact that it's some random concept of "member" -- not
> the "users" from the authentication system.

Ahhh, now I see. Thanks!

Bryan

Offline

Board footer

Moderator control

Enjoy the 18th of November
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support