[Mailman-Developers] Mailman + DB: Snag

Chris Ryan chris@greatbridge.com
Thu, 15 Mar 2001 09:07:16 -0500


	As a test I implemented a basic interface driver with mailman that
loaded the config.db and implemented the internalName() and realName()
methods. Everything worked fine which was good except one thing.

	The way the admin.py update the attributes does not work with the
interface driver. I'm trying to find a reasonable solution that would
allow the current code to work as it stands without having to overhaul
the entire web interface update code.

	One possible solution that I can think of is to replace the getattr()
setattr() methods that are currently used with a similar function that
would instead use a switched case on the variable to know which
attribute the get/set.

for example:

    Current method:
        property = 'real_name'
        value = getattr(mlist,property,'some default')

        setattr(mlist,property, value)

    New method (concept):

        property = 'real_name'
        value = mlist.getProperty(property,'some default')

        mlist.setProperty(property, value)

        def MailList.getProperty(self, property, default=None)
            if property == 'real_name':
                return self.list_data.realName()
            elif property == '...':
            elif property == '...':
            else:
                if default:
                    return default
                else:
                    raise AttributeError

	I'll have to look through the python documentation to see if there is a
way to dynamically call a method as that would further simplify the
above. Does this sound reasonable? Or is there a better way to deal with
this problem?

Chris Ryan
chris@greatbridge.org