def validate_key(self, activation_key):
        """
        Verify that the activation key is valid and within the
        permitted activation time window, returning the username if
        valid or raising ``ActivationError`` if not.

        """
        try:
            username = signing.loads(
                activation_key,
                salt=REGISTRATION_SALT,
                max_age=settings.ACCOUNT_ACTIVATION_DAYS * 86400
            )
            return username
        except signing.SignatureExpired:
            raise ActivationError(
                self.EXPIRED_MESSAGE,
                code='expired'
            )
        except signing.BadSignature:
            raise ActivationError(
                self.INVALID_KEY_MESSAGE,
                code='invalid_key',
                params={'activation_key': activation_key}
            )
def validate_key ( self , activation_key ) : try : username = signing . loads ( activation_key , salt = REGISTRATION_SALT , max_age = settings . ACCOUNT_ACTIVATION_DAYS * 86400 ) return username except signing . SignatureExpired : raise ActivationError ( self . EXPIRED_MESSAGE , code = 'expired' ) except signing . BadSignature : raise ActivationError ( self . INVALID_KEY_MESSAGE , code = 'invalid_key' , params = { 'activation_key' : activation_key } )
Verify that the activation key is valid and within the
        permitted activation time window, returning the username if
        valid or raising ``ActivationError`` if not.