[Mailman-Users] control delivery processes
DongInn Kim
dikim at cs.indiana.edu
Tue Mar 4 02:29:52 CET 2014
Hi Mark,
Thanks for all your help but I still have a problem with updating foot_msg attribute.
[root at lion Mailman]# grep -n10 time Handlers/Decorate.py
11-# GNU General Public License for more details.
12-#
13-# You should have received a copy of the GNU General Public License
14-# along with this program; if not, write to the Free Software
15-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
16-# USA.
17-
18-"""Decorate a message by sticking the header and footer around it."""
19-
20-import re
21:import time
22-
23-from types import ListType
24-from email.MIMEText import MIMEText
25-
26-from Mailman import mm_cfg
27-from Mailman import Utils
28-from Mailman import Errors
29-from Mailman.Message import Message
30-from Mailman.i18n import _
31-from Mailman.SafeDict import SafeDict
--
221- # blacklist of known bad ones.
222- d = SafeDict({'real_name' : mlist.real_name,
223- 'list_name' : mlist.internal_name(),
224- # For backwards compatibility
225- '_internal_name': mlist.internal_name(),
226- 'host_name' : mlist.host_name,
227- 'web_page_url' : mlist.web_page_url,
228- 'description' : mlist.description,
229- 'info' : mlist.info,
230- 'cgiext' : mm_cfg.CGIEXT,
231: 'time' : time.strftime("%Y/%m"),
232- })
233- if extradict is not None:
234- d.update(extradict)
235- # Using $-strings?
236- if getattr(mlist, 'use_dollar_strings', 0):
237- template = Utils.to_percent(template)
238- # Interpolate into the template
239- try:
240- text = re.sub(r'(?m)(?<!^--) +(?=\n)', '',
241- re.sub(r'\r\n', r'\n', template % d))
I added the ‘time’ variable to the ‘d’ dictionary in Handlers/Decorate.py as you mentioned but I got the following error:
"Warning: The following illegal substitution variables were found in the msg_footer string: time
Your list may not operate properly until you correct this problem. "
Is there anything wrong with this?
Regards,
--
- DongInn
On Mar 3, 2014, at 8:14 PM, Mark Sapiro <mark at msapiro.net> wrote:
> On 03/03/2014 04:46 PM, DongInn Kim wrote:
>> Can anyone please help me to debug the syntax error in mm_cfg.py?
>>
>> ompi_list = [ 'test-crest', 'osl-test' ]
>> if listname in ompi_list:
>> archive_url = ("http://www.open-mpi.org/community/lists/devel/%s/date.php" % (time.strftime("%Y/%m")))
>> DEFAULT_MSG_FOOTER = """_______________________________________________
>> %(real_name)s mailing list
>> %(real_name)s@%(host_name)s
>> subscribe: %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
>> searchable archives: %(archive_url)s
>> """ % { 'archive_url' : archive_url }
>>
>>
>> What I wanted here is to apply the new DEFAULT_MSG_FOOTER only for the specific mailing lists.
>> Is there something wrong here?
>
>
> There are several thinks wrong. At the time mm_cfg.py is imported, the
> name listname is not defined. This is your syntax error, but beyond
> that, you have a huge misunderstanding of how to go about what you are
> trying to do.
>
> DEFAULT_MSG_FOOTER only establishes the default value for a newly
> created list. What you want is to set the msg_footer attribute for the
> 'test-crest' and 'osl-test' lists to something like:
>
> """_______________________________________________
> %(real_name)s mailing list
> %(real_name)s@%(host_name)s
> subscribe: %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
> searchable archives:
> http://www.open-mpi.org/community/lists/devel/%(time)s/date.php
> """
>
> And then modify Mailman/Handlers/Decorate.py to import time and augment
> the replacement dictionary by adding {'time': time.strftime("%Y/%m")}.
>
> --
> 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
> https://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: https://mail.python.org/mailman/options/mailman-users/dikim%40cs.indiana.edu
More information about the Mailman-Users
mailing list