On Tue, 20 Aug 2002, Barry A. Warsaw wrote: > >>>>> "DN" == Dale Newfield <[EMAIL PROTECTED]> writes: > DN> I guess what I'm suggesting is that instead of using this > DN> accessor like this: mlist.getMemberOption(addr, > DN> mm_cfg.OPTINFO['plain']), it be used like this: > DN> mlist.getMemberOption(addr, 'plain')
> The problem that I have with this approach is that it's much easier to > let a typo like mm_cfg.OPTINFO['plian'] slip through than to use a > symbolic constant. E.g. tools like Pychecker can verify that the > constant exists, but can't really do much with the string. Can we make the symbolic constant *be* the string? Then we can get both compile-time checking and a non-obfuscated API. Basically we'd replace: # Bitfield for user options. See DEFAULT_NEW_MEMBER_OPTIONS above to set # defaults for all new lists. Digests = 0 # handled by other mechanism, doesn't need a flag. DisableDelivery = 1 # Obsolete; use set/getDeliveryStatus() DontReceiveOwnPosts = 2 # Non-digesters only AcknowledgePosts = 4 DisableMime = 8 # Digesters only ConcealSubscription = 16 SuppressPasswordReminder = 32 ReceiveNonmatchingTopics = 64 Moderate = 128 DontReceiveDuplicates = 256 # A mapping between short option tags and their flag OPTINFO = {'hide' : ConcealSubscription, 'nomail' : DisableDelivery, 'ack' : AcknowledgePosts, 'notmetoo': DontReceiveOwnPosts, 'digest' : 0, 'plain' : DisableMime, 'nodupes' : DontReceiveDuplicates } With something like: # Strings for user options. See DEFAULT_NEW_MEMBER_OPTIONS above to set # defaults for all new lists. Digests = 'digest' DisableDelivery = 'nomail' DontReceiveOwnPosts = 'notmetoo' AcknowledgePosts = 'ack' DisableMime = 'plain' ConcealSubscription = 'hide' SuppressPasswordReminder = 'noreminder' # made up... ReceiveNonmatchingTopics = 'newtopics' # made up... Moderate = 'moderate' # made up... DontReceiveDuplicates = 'nodupes' # This could probably move inside OldStyleMemberships.py # Why are more of the above ones not in this? # A mapping between short option tags and their flag OPTINFO = {ConcealSubscription : 16, DisableDelivery : 1, AcknowledgePosts : 4, DontReceiveOwnPosts : 2, Digests : 0, DisableMime : 8, DontReceiveDuplicates : 256 } Note that DEFAULT_NEW_MEMBER_OPTIONS should probably become a list of strings, expanded to current value by |'ing together each OPTINFO[listentry] If you'd like me to try to make a clean pass of this and submit a patch, let me know. It seems that API changes should happen sooner than later so that any other implementations of this interface also get built to the same API... -Dale _______________________________________________ Mailman-Developers mailing list [EMAIL PROTECTED] http://mail.python.org/mailman-21/listinfo/mailman-developers