auth.login function not working as expected

68 views
Skip to first unread message

Abraham Yusuf

unread,
Dec 18, 2011, 4:25:21 PM12/18/11
to django...@googlegroups.com
Hi all,
I'm trying to login a user using django's authentication backend with the following:
user=auth.authenticate(userid,pass)
if user:
if user.is_active:
auth.login(request,user)
I am getting TypeError login() takes exactly 1 argument (2 given). I've checked the docs and i can't find any problem there. Pls any help will be appreciated. Am using django 1.3.1, python 2.7 on ubuntu 11.04.

Jhonny5

unread,
Dec 18, 2011, 3:37:10 PM12/18/11
to django...@googlegroups.com
Hi,
2011/12/18 Abraham Yusuf <bb...@yahoo.com>
Do you have maybe another function called login(one_argument).

Cheers,
J.
 
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.




--

Linux User #236965 (counter.li.org)
Po fueno, po fale, po malegro.

Jhonny5

unread,
Dec 18, 2011, 3:43:24 PM12/18/11
to django...@googlegroups.com
2011/12/18 Jhonny5 <jho...@gmail.com>
Hi,
2011/12/18 Abraham Yusuf <bb...@yahoo.com>
Hi all,
I'm trying to login a user using django's authentication backend with the following:
user=auth.authenticate(userid,pass)
if user:
  if user.is_active:
     auth.login(request,user)
I am getting TypeError login() takes exactly 1 argument (2 given). I've checked the docs and i can't find any problem there. Pls any help will be appreciated. Am using django 1.3.1, python 2.7 on ubuntu 11.04.


Do you have maybe another function called login(one_argument).


Just realize it's from auth object, but i had same problem with conflicts on that... check that way out maybe.
 


Cheers,
J.
 
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.




--

Linux User #236965 (counter.li.org)
Po fueno, po fale, po malegro.

Abraham Yusuf

unread,
Dec 18, 2011, 7:02:27 PM12/18/11
to django...@googlegroups.com
Hi all,
I found a solution to the problem so i taught i'd let you know. It was really an oversight, my login view is like so:

@return_json
def login(request)

In the decorator i was ripping off the raw post data and passing it to the view as arguments while the view itself only takes the request arg. Sorry for posting it anyway.

DrBloodmoney

unread,
Dec 19, 2011, 2:05:11 PM12/19/11
to django...@googlegroups.com

It sounds like you have solved your problem. In case you haven't, in
the auth.login() call above you have request <comma> user instead of
request <period> user. That would also give you the same error.

Reply all
Reply to author
Forward
0 new messages