auth.login function not working as expected

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

auth.login function not working as expected

Abraham Yusuf
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.

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

Reply | Threaded
Open this post in threaded view
|

Re: auth.login function not working as expected

Jhonny5
Hi,
2011/12/18 Abraham Yusuf <[hidden email]>
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).

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 [hidden email].
To unsubscribe from this group, send email to [hidden email].
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.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: auth.login function not working as expected

Jhonny5
2011/12/18 Jhonny5 <[hidden email]>
Hi,
2011/12/18 Abraham Yusuf <[hidden email]>
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 [hidden email].
To unsubscribe from this group, send email to [hidden email].
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.




--

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

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Reply | Threaded
Open this post in threaded view
|

RE: auth.login function not working as expected

Abraham Yusuf
In reply to this post by Abraham Yusuf
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.

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

Reply | Threaded
Open this post in threaded view
|

Re: auth.login function not working as expected

DrBloodmoney
In reply to this post by Abraham Yusuf
On Sun, Dec 18, 2011 at 4:25 PM, Abraham Yusuf <[hidden email]> wrote:
> 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.

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.

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