Re: trying get latest zmailman running

Simon Michael <[email protected]> Wed, 18 Dec 2002 11:43:45 -0800
Newsgroups gmane.comp.web.zope.zmailman
Organization Joyful Systems
Message-ID <[email protected]>
--=-=-=

[email protected] (Barry A. Warsaw) writes:
>     SM> stick with 2.1 for zope. So I /usr/local/lib/python2.2/email
>     SM> to /usr/local/lib/python1.5 - I don't know for sure if that
>
> I don't know for sure what that last sentence means! :)

Sorry - I *copied* it. 

> BTW, Mailman 2.1's cvs has the required email package as a distutils
> tarball in its misc directory.  v2.4.3 should work pretty well, and
> that's what comes with Python 2.2.2.  Mailman installs that into its
> pythonlib directory which it arranges to be on sys.path.  You could
> install it in Python 2.1's site-packages or Zope's lib/python and be
> fine.

Thanks. All seems well, and later I found this mentioned in
ZMailman/docs/INSTALL.txt. (Nice, I unconsciously assumed a zope product
docs directory must be empty :).

Stephan Richter <[email protected]> writes:
> Weired error. Maybe upgrading to Zope 2.6.0 will help? I think we should
> shoot for the latest Zope version. Anyhow, this does not really seem

I'll try it on my 2.6 server later. I found this prior thread on the same
issue: http://mail.iuveno-net.de/pipermail/zmailman/2002-February/000138.html .
I'll probably try adding ClassSecurityInfo declarations.

Meanwhile, I hacked up a "micro zmailman" - a couple of inefficient
external methods just good enough to allow me to build a simple UI for
people to change their delivery options (individual, digest, none).  I've
attached it, but a nice up-to-date full-featured zmailman will be better.

I have become a mailman fan by the way (I upgraded to mailman-cvs for
this).  A related project is to use mailman for zwiki mail delivery, and
this is working out well.  It was fun to see 2.1's topics support - they
correspond very closely to wiki pages in the latest wikimail setup.

Regards,
-Simon


--=-=-=
Content-Disposition: attachment; filename=manageMailmanOptions.py

# "zmailman light" - quick hack to get and set a mailman list member's options
# tested with mailman-cvs ~2002/12

import string
from Mailman.Defaults import \
     Digests, \
     DisableDelivery, \
     DontReceiveOwnPosts, \
     AcknowledgePosts, \
     DisableMime, \
     ConcealSubscription, \
     SuppressPasswordReminder, \
     ReceiveNonmatchingTopics, \
     Moderate, \
     DontReceiveDuplicates
from Mailman.MemberAdaptor import ENABLED,BYUSER
from Mailman.Errors import \
     AlreadyReceivingDigests, AlreadyReceivingRegularDeliveries
from Mailman import MailList


def getMailmanOptions(self,list,member):
    """Return some of a mailman list member's options as a dictionary."""
    adaptor = MailList.MailList(list, lock=0)._memberadaptor
    return {
        'Digests':adaptor.getMemberOption(member, Digests),
        'DeliveryDisabled':adaptor.getDeliveryStatus(member) != ENABLED,
        }

def setMailmanOptions(self,list,member,**options):
    """Set some options for a mailman list member."""
    ml = MailList.MailList(list, lock=1)
    try:
        changed = 0
        adaptor = ml._memberadaptor
        if options.has_key('Digests'):
            try:
                changed = 1
                adaptor.setMemberOption(member, Digests, options['Digests'])
            except (AlreadyReceivingDigests, AlreadyReceivingRegularDeliveries):
                pass
        if options.has_key('DeliveryDisabled'):
            changed = 1
            if options['DeliveryDisabled']:
                adaptor.setDeliveryStatus(member,BYUSER)
            else:
                adaptor.setDeliveryStatus(member,ENABLED)
        if changed:
            ml.Save()
    finally:
        ml.Unlock()

def setMailmanDelivery(self,list,member,**options):
    """Allow mailman's digest and disable delivery options to be set as one."""
    if options.has_key('delivery'):
        delivery = string.lower(options['delivery'])
        if delivery == 'none':
            self.setMailmanOptions(list,member,DeliveryDisabled=1)
        elif delivery == 'digest':
            self.setMailmanOptions(list,member,DeliveryDisabled=0,Digests=1)
        else:
            self.setMailmanOptions(list,member,DeliveryDisabled=0,Digests=0)

--=-=-=--