I do something like.

    # get the user to check tries
    user = User.object.get(username=username)
    assert user.count <= 3

    # authenticate
    authenticated_user = authenticate(...)

    # auth failed
    if not authenticated_user:
        user.count++
        user.save()
        raise

    # auth ok
    user.count = 0
    user.save()   # <A>

    # return user annotated by authenticate()
    return authenticated_user


Maybe the problem is doing <A>.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/c11bbd7b-4338-4f8c-b5ed-14dcd81c6fa1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to