[Mailman-Users] Mailman MySQL backend migration question

kphamilton khamilton at umem.org
Thu Jul 7 04:13:35 CEST 2011


I have actually accomplished this! Woohoo! I did upgrade as you said to
MysqlMemberships.py. 

I accomplished the rest in a different manner than you suggested, so I will
share if others attempt this.

I used export in the /bin folder to export all list data in xml format. 

I then wrote a python script that parsed through the xml file for each list
and added appropriate members to the appropriate MySQL table. This proved to
be fairly tricky as some of the attributes in the tables are not actually
what are used to store the information (mostly dealing with the
preferences). 

While there are fields in the tables for preferences like nomail, ack,
plain, etc, these are unused fields. The field that controls most of the
preferences is user_options. Thanks to a few tutorials (I am at home now so
I do not have any URLs from work), I was able to decipher the values
required to save preferences. 

Although I used a different strategy, I thank you Mark Sapiro for your
attempted help. You actually did help me on this project because you were
the poster in a lot of the tutorials I referenced throughout the process. 

Thanks again!
-Kevin





Mark Sapiro-3 wrote:
> 
> Mark Sapiro wrote:
>>
>>------------------------------------------------------------
>>from Mailman import mm_cfg
>>from Mailman import OldStyleMemberships as OSM
>>
>>def move_members(mlist):
>>    if not mlist.Locked():
>>        mlist.Lock()
>>    for member in OSM.getMembers(mlist):
>>        if mlist.isMember(member):
>>            continue
>>        cpmember = OSM.getMemberCPAddress(mlist, member)
>>        digest = OSM.getMemberOption(mlist, member, mm_cfg.Digests)
>>        password = OSM.getMemberPassword(mlist, member)
>>        language = OSM.getMemberLanguage(mlist, member)
>>        realname = OSM.getMemberName(mlist, member)
>>        mlist.addNewMember(cpmember, digest=digest, password=password,
>>                           language=language, realname=realname)
>>        mlist.setDeliveryStatus(member,
>>                                OSM.getDeliveryStatus(mlist, member))
>>        for flag in (mm_cfg.DontReceiveOwnPosts,
>>                     mm_cfg.AcknowledgePosts,
>>                     mm_cfg.DisableMime,
>>                     mm_cfg.ConcealSubscription,
>>                     mm_cfg.SuppressPasswordReminder,
>>                     mm_cfg.ReceiveNonmatchingTopics,
>>                     mm_cfg.Moderate,
>>                     mm_cfg.DontReceiveDuplicates,
>>                    ):
>>            mlist.setMemberOption(member, flag,
>>                            OSM.getMemberOption(mlist, member, flag))
>>        mlist.setMemberTopics(member,
>>                              OSM.getMemberTopics(mlist, member))
>>        OSM.removeMember(mlist, member)
>>        mlist.Save()
>>        mlist.Unlock()
>>------------------------------------------------------------
> 
> 
> I forgot to note that the above was untested and without warranty. In
> particular, the last two lines
> 
>         mlist.Save()
>         mlist.Unlock()
> 
> should only be indented 4 spaces, not 8 as in
> 
>     mlist.Save()
>     mlist.Unlock()
> 
> That change will at least give it a chance of processing more than one
> old member before dying.
> 
> -- 
> Mark Sapiro <mark at msapiro.net>        The highway is for gamblers,
> San Francisco Bay Area, California    better use your sense - B. Dylan
> 
> ------------------------------------------------------
> Mailman-Users mailing list Mailman-Users at python.org
> http://mail.python.org/mailman/listinfo/mailman-users
> Mailman FAQ: http://wiki.list.org/x/AgA3
> Security Policy: http://wiki.list.org/x/QIA9
> Searchable Archives:
> http://www.mail-archive.com/mailman-users%40python.org/
> Unsubscribe:
> http://mail.python.org/mailman/options/mailman-users/lists%40nabble.com
> 
> 

-- 
View this message in context: http://old.nabble.com/Mailman-MySQL-backend-migration-question-tp32000121p32009929.html
Sent from the Mailman - Users mailing list archive at Nabble.com.



More information about the Mailman-Users mailing list