summaryrefslogtreecommitdiff
path: root/Mailman/database/model/user.py
diff options
context:
space:
mode:
authorBarry Warsaw2007-06-09 18:16:29 -0400
committerBarry Warsaw2007-06-09 18:16:29 -0400
commit5bc4941f0b749830d5e4feb57be5f172e77e0631 (patch)
treeac56f0b3ed7398673d97bcf737c8ea9143704ef6 /Mailman/database/model/user.py
parent3231fd628f6eea30bd6e2be56eb419ed0008d954 (diff)
downloadmailman-5bc4941f0b749830d5e4feb57be5f172e77e0631.tar.gz
mailman-5bc4941f0b749830d5e4feb57be5f172e77e0631.tar.zst
mailman-5bc4941f0b749830d5e4feb57be5f172e77e0631.zip
Repair the usermanager.txt and listmanager.txt doc tests. These repairs were
necessary to deal with the simplified user model. Eradicate more references to rosters and roster sets. Give Users a repr. Also give them a belongs_to() link to Preferences, but change the user manager to not give a user preferences by default (the lookup schema should properly handle users with no preferences now). Also, when creating a user, set their real_name to the empty string if no real_name argument was given to create_user(). Update the IUserManager interface's create_user() method to match the implementation.
Diffstat (limited to 'Mailman/database/model/user.py')
-rw-r--r--Mailman/database/model/user.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Mailman/database/model/user.py b/Mailman/database/model/user.py
index d646606a9..06fb1f6f3 100644
--- a/Mailman/database/model/user.py
+++ b/Mailman/database/model/user.py
@@ -24,6 +24,7 @@ from Mailman.database.model import Address
from Mailman.interfaces import IUser
ADDRESS_KIND = 'Mailman.database.model.address.Address'
+PREFERENCE_KIND = 'Mailman.database.model.profile.Preferences'
@@ -33,10 +34,14 @@ class User(Entity):
has_field('real_name', Unicode)
has_field('password', Unicode)
# Relationships
- has_many('addresses', of_kind=ADDRESS_KIND)
+ has_many('addresses', of_kind=ADDRESS_KIND)
+ belongs_to('preferences', of_kind=PREFERENCE_KIND)
# Options
using_options(shortnames=True)
+ def __repr__(self):
+ return '<User "%s" at %#x>' % (self.real_name, id(self))
+
def link(self, address):
if address.user is not None:
raise Errors.AddressAlreadyLinkedError(address)