Program to Change List Real Name

Mailman Folks,
Who do I convert these manual instructions into a program?
bin/withlist bar
>>> m.real_name='bar'
>>> m.Lock()
>>> m.Save()
>>> m.Unlock()
>>> ^D
Thanks.
Jim

On 6/1/11 8:51 PM, UUN Hostmaster wrote:
First of all, that is wrong. the m.Lock() will reload the list object and undo the m.real_name='bar'. Just add -l to the withlist command and don't do either m.Lock() or m.Unlock().
To make a script, put something like
def rename_list(mlist): if not mlist.Locked(): mlist.Lock() mlist.real_name = mlist.internal_name() mlist.Save() mlist.Unlock()
in a file named rename_list.py in Mailman's bin/ directory and then you can run
bin/withlist -r rename_list bar
However, if this is cPanel there may be problems with the above.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California Better use your sense - B. Dylan

Mark,
Thank you.
What kinds of problems do you anticipate with cPanel Mailman?
I looked at the config_list of a CPanel Mailman mailing list: list-name_domain-name.tld. It appears like a normal Mailing installation except that the real_name = "list-name" Otherwise, the folders and files are named list-name_domain-name.tld
I am migrating some Majordomo Mailing lists to a CPanel Mailman installation.
Thanks.
Jim
Jim

On 6/2/2011 2:13 PM, UUN Hostmaster wrote:
Mark Sapiro wrote:
However, if this is cPanel there may be problems with the above.
That's the point. The script I posted with
mlist.real_name = mlist.internal_name()
will set real_name to the list-name_domain-name.tld name rather than just list-name.
I am migrating some Majordomo Mailing lists to a CPanel Mailman installation.
So what are you really trying to accomplish? If you create the lists with cPanel's list create process (as opposed to Mailman's bin/newlist) they should get the appropriate real_name.
If you explain in more detail what you are doing and what needs to be fixed about the lists' real_name, I can give you a script to do it.
If the issue is that you have lists with real_name = list-name_example.com and you want to change real_name to just list-name, put the following script in /usr/local/cpanel/3rdparty/mailman/bin/rename_list.py
def rename_list(mlist): if not mlist.Locked(): mlist.Lock() listfullname = mlist.internal_name() last_underscore = listfullname.rfind('_'); if last_underscore > 0: listname = listfullname[0:last_underscore] else: listname = listfullname mlist.real_name = listname mlist.Save() mlist.Unlock()
You can then run that with
bin/withlist -r rename_list foo_example.com
to do the foo_example.com list or
bin/withlist -r rename_list -a
to do all lists.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan

Mark,
I can't use the cPanel Web Interface because I have too many mailing lists to create. If I use the Mailman newlist command to create list-name_domain-name.tld, I need to change the real_name from list-name_domain-name.tld to list-name. Also, I have to create my own entries in the /etc/valiases/domain-name.tld file.
I found a program that will extract the needed information from the Majordomo files: majordomo2mailman.pl. I had to modify parts of the program to add the real_name and host_name, so I could create the list-name_domain-name.tld for the newlist command.
I modified your python program to fit my needs:
def rename_list(mlist): if not mlist.Locked(): mlist.Lock() mlist.real_name = mlist.internal_name().split("_" + mlist.host_name)[0] mlist.Save() mlist.Unlock()
It works.
Jim

On 6/1/11 8:51 PM, UUN Hostmaster wrote:
First of all, that is wrong. the m.Lock() will reload the list object and undo the m.real_name='bar'. Just add -l to the withlist command and don't do either m.Lock() or m.Unlock().
To make a script, put something like
def rename_list(mlist): if not mlist.Locked(): mlist.Lock() mlist.real_name = mlist.internal_name() mlist.Save() mlist.Unlock()
in a file named rename_list.py in Mailman's bin/ directory and then you can run
bin/withlist -r rename_list bar
However, if this is cPanel there may be problems with the above.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California Better use your sense - B. Dylan

Mark,
Thank you.
What kinds of problems do you anticipate with cPanel Mailman?
I looked at the config_list of a CPanel Mailman mailing list: list-name_domain-name.tld. It appears like a normal Mailing installation except that the real_name = "list-name" Otherwise, the folders and files are named list-name_domain-name.tld
I am migrating some Majordomo Mailing lists to a CPanel Mailman installation.
Thanks.
Jim
Jim

On 6/2/2011 2:13 PM, UUN Hostmaster wrote:
Mark Sapiro wrote:
However, if this is cPanel there may be problems with the above.
That's the point. The script I posted with
mlist.real_name = mlist.internal_name()
will set real_name to the list-name_domain-name.tld name rather than just list-name.
I am migrating some Majordomo Mailing lists to a CPanel Mailman installation.
So what are you really trying to accomplish? If you create the lists with cPanel's list create process (as opposed to Mailman's bin/newlist) they should get the appropriate real_name.
If you explain in more detail what you are doing and what needs to be fixed about the lists' real_name, I can give you a script to do it.
If the issue is that you have lists with real_name = list-name_example.com and you want to change real_name to just list-name, put the following script in /usr/local/cpanel/3rdparty/mailman/bin/rename_list.py
def rename_list(mlist): if not mlist.Locked(): mlist.Lock() listfullname = mlist.internal_name() last_underscore = listfullname.rfind('_'); if last_underscore > 0: listname = listfullname[0:last_underscore] else: listname = listfullname mlist.real_name = listname mlist.Save() mlist.Unlock()
You can then run that with
bin/withlist -r rename_list foo_example.com
to do the foo_example.com list or
bin/withlist -r rename_list -a
to do all lists.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan

Mark,
I can't use the cPanel Web Interface because I have too many mailing lists to create. If I use the Mailman newlist command to create list-name_domain-name.tld, I need to change the real_name from list-name_domain-name.tld to list-name. Also, I have to create my own entries in the /etc/valiases/domain-name.tld file.
I found a program that will extract the needed information from the Majordomo files: majordomo2mailman.pl. I had to modify parts of the program to add the real_name and host_name, so I could create the list-name_domain-name.tld for the newlist command.
I modified your python program to fit my needs:
def rename_list(mlist): if not mlist.Locked(): mlist.Lock() mlist.real_name = mlist.internal_name().split("_" + mlist.host_name)[0] mlist.Save() mlist.Unlock()
It works.
Jim
participants (2)
-
Mark Sapiro
-
UUN Hostmaster