Anonymous committed 195dbb4

Only compile the SHA1 regex once per process

Comments (0)

Files changed (1)


 from django.contrib.sites.models import Site
 from django.conf import settings
+SHA1_RE = re.compile('^[a-f0-9]{40}$')
 class RegistrationManager(models.Manager):
         # Make sure the key we're trying conforms to the pattern of a
         # SHA1 hash; if it doesn't, no point even trying to look it up
         # in the DB.
-        if re.match('[a-f0-9]{40}', activation_key):
+        if
                 user_profile = self.get(activation_key=activation_key)
             except self.model.DoesNotExist: