[Mailman3-dev] Mailing list attributes: immediate access, or proxied?

Barry Warsaw barry at python.org
Wed Mar 30 05:15:46 CEST 2005


On Tue, 2005-03-29 at 00:50, Robin Munn wrote:

> During the PyCon sprints, we created a MailingList object in
> src/mailman/mlist.py which has __getattr__() and __setattr__() methods
> to set mailing list attributes such as "max_hold" or "enable_archives".
> I've been rethinking that decision; I think another method might be
> slightly better. Instead of using straight attribute access, I think it
> might be better to use a proxy object. Call it "attr", or maybe just
> "a". Possibly both could be allowable. 

That's a good point, and something I'd thought about during the first
rewrite (I'm not sure that made it into the branches snapshot though). 
I too dislike having to type that extra dotted-path for /every/
attribute access, but it may well be something we have to add.

OTOH, maybe we don't need to worry much about collisions between
attributes of the MailingList class and dynamic, schema-fed attributes. 
Attribute lookup always returns an entry from the instance's dictionary
(or its class's) before calling __getattr__().  For our own dynamic
attributes, we need only be internally careful about name collisions.

Third party add-ons will have to be doubly careful because first, they
can't collide with an attribute we're storing in the database, and
second, they can't collide with one of the items in the MailingList's
dictionary.  So they already have to be careful.

I'd be inclined to leave things where they are for now.

-Barry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: This is a digitally signed message part
Url : http://mail.python.org/pipermail/mailman3-dev/attachments/20050329/500b1ceb/attachment.pgp


More information about the Mailman3-Dev mailing list