Hey,

Sorry I'm a bit confused so I'm going to try to make some sense of
your situation "out loud" :)

1. User.objects.get(username="some_username") works some-times
2. When it doesn't work, then you get the DoesNotExist exception, right?
3. If not, what error(s) do you see?
4. Are you sure the user, with that username, does exist when you get
the exception?
5. If you are sure they exist and you still get the exception, did you
look into the database itself to see if it exists? Or how did you come
to this conclusion?

On Tue, May 22, 2012 at 4:49 PM, Hanne Moa <hanne....@gmail.com> wrote:
> I upgraded python to 2.6.8 today from an earlier 2.6, what an
> adventure! So much bizarre happenings so many places. Tonight's
> special:
>
> SomeModel.objects.get(sometextfield=sometext) always works (when there
> is one entry where sometextfield=sometext of course).
>
> auth.User.objects.get(username=sometext) works only *sometimes*.
>
> In a login-view, I first check that the user for a given username
> exists. It does! User found. Then I try to authenticate:
> auth.authenticate(user.username, password). That never works!
> Monkeypatching authenticate() shows that the
> User.objects.get(username=username) in it always returns
> User.DoesNotExist. But of course:
> User.objects.filter(username__startswith=username).get(username__endswith=username)
> always return the user in question. And the only thing that has
> changed is the minor python version.
>
> I can't get User.objects.get(username=whatever) to work in the shell either.
>
> How do I debug this further? This is for django 1.3, I need to have
> this working predictably again before I can upgrade to 1.4. I have
> logs of the sql if that'll help but the sql looks fine.
>
>
> HM
>
> --
> 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+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>

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

Reply via email to