Re: [Mailman-Developers] "Address already exists" when creating users, but it creates a new user anyway
After a bit of deep cave diving into the code I suspect it’s this in model/usermanager.py
This function appears to create a user before it checks to see if the address exists, with the result that multiple users are created when the address already exists.
@implementer(IUserManager)
class UserManager:
"""See IUserManager
."""
def create_user(self, email=None, display_name=None):
"""See `IUserManager`."""
user = User(display_name, Preferences())
if email:
address = self.create_address(email, display_name)
user.link(address)
return user
this seems to fix the problem - but please don’t trust my solution - needs verification.
@implementer(IUserManager)
class UserManager:
"""See IUserManager
."""
def create_user(self, email=None, display_name=None):
"""See `IUserManager`."""
if email:
address = self.create_address(email, display_name)
user = User(display_name, Preferences())
if email:
user.link(address)
return user
On 5 Feb 2015, at 7:59 am, Barry Warsaw <barry@list.org> wrote:
On Feb 05, 2015, at 07:23 AM, Andrew Stuart wrote:
To get the source I do:
bzr branch lp:mailman
Is this the correct way?
I’m using Python 3.4
Yep, exactly so.
Thanks. I'll give it a go tonight. -B
On Feb 05, 2015, at 09:32 AM, Andrew Stuart wrote:
After a bit of deep cave diving into the code I suspect it’s this in model/usermanager.py
You're exactly right. Thanks for filing LP: #1418280.
I'll commit your fix along with some new tests.
Cheers, -Barry
participants (2)
-
Andrew Stuart
-
Barry Warsaw