Friday, May 30, 2014

check_password in contrib auth tries to update the database

Hi,

I am getting this error 
cannot execute UPDATE in a read-only transaction
from a method in auth module that supposedly checks for password.

check_password method of AbstractBaseUser in django.contrib.auth.models tries to update the database.
This causes problems when this code executes on a read-only slave database.

Here is the source code of the method:

    def check_password(self, raw_password):
        """
        Returns a boolean of whether the raw_password was correct. Handles
        hashing formats behind the scenes.
        """
        def setter(raw_password):
            self.set_password(raw_password)
            self.save(update_fields=["password"])
        return check_password(raw_password, self.password, setter)


Has anyone come across this issue before? 

--
Suhrid

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f754fc33-fd4c-4653-bf6f-ddffa58542e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment