After reviewing your patch, I think the method should be moved to
AbstractBaseUser not AbstractUser. All subclasses of AbstractBaseUser need
to have an email field, as per their EMAIL_FIELD property, so putting the
normalize method there makes sense to me.

On Wed, 14 Oct 2020 at 22:15, Jacob Walls <[email protected]> wrote:

> Hi list,
>
> I picked up an optimization from the backlog
> <https://code.djangoproject.com/ticket/26790> proposing to move the
> method normalize_email() from BaseUserManager to AbstractUser, where the
> email field is defined. The proposal involved a deprecation period for
> users who rely on the current behavior.
>
> I prepared a patch <https://github.com/django/django/pull/13527>, but to
> get the test suite to pass I had to support the scenario where a subclass
> of AbstractBaseUser relies on a subclass of UserManager (rather than
> BaseUserManager) to create objects. If that behavior has to be supported
> after the deprecation period, I think there is little point in moving
> normalize_email()--the method belongs on BaseUserManager after all.
>
> So, I'm asking for opinions on these options:
>
> #1 -- Leave normalize_email() on BaseUserManager and close the ticket.
> #2 -- Deprecate the behavior where subclasses of AbstractBaseUser rely on
> UserManager to create objects.
>
> Advice and further guidance welcome.
> Jacob
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/759fee19-7c2d-49c6-9a6d-07ab87612cf9n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-developers/759fee19-7c2d-49c6-9a6d-07ab87612cf9n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Adam

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAMyDDM0Cq6V1EjLUQ0v8yUE9ZEOdJHDRuX54%3DLQmsZYaySs-QA%40mail.gmail.com.

Reply via email to