Deprecate UserManager managing AbstractBaseUser objects?

88 views
Skip to first unread message

Jacob Walls

unread,
Oct 14, 2020, 6:31:41 PM10/14/20
to Django developers (Contributions to Django itself)
Hi list,

I picked up an optimization from the backlog 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, 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


Adam Johnson

unread,
Oct 15, 2020, 7:26:41 PM10/15/20
to django-d...@googlegroups.com
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.

--
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 django-develop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/759fee19-7c2d-49c6-9a6d-07ab87612cf9n%40googlegroups.com.


--
Adam
Reply all
Reply to author
Forward
0 new messages