~futatuki/mailman/2.1-forbid-subscription

« back to all changes in this revision

Viewing changes to bin/convert.py

  • Committer:
  • Date: 2003-01-02 05:25:50 UTC
  • Revision ID: vcs-imports@canonical.com-20030102052550-qqbl1i96tzg3bach
This commit was manufactured by cvs2svn to create branch
'Release_2_1-maint'.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! @PYTHON@
 
2
#
 
3
# Copyright (C) 2002 by the Free Software Foundation, Inc.
 
4
#
 
5
# This program is free software; you can redistribute it and/or
 
6
# modify it under the terms of the GNU General Public License
 
7
# as published by the Free Software Foundation; either version 2
 
8
# of the License, or (at your option) any later version.
 
9
 
10
# This program is distributed in the hope that it will be useful,
 
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
# GNU General Public License for more details.
 
14
 
15
# You should have received a copy of the GNU General Public License
 
16
# along with this program; if not, write to the Free Software 
 
17
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
18
 
 
19
"""Convert a list's interpolation strings from %-strings to $-strings.
 
20
 
 
21
This script is intended to be run as a bin/withlist script, i.e.
 
22
 
 
23
% bin/withlist -l -r convert <mylist>
 
24
"""
 
25
 
 
26
import paths
 
27
from Mailman import Utils
 
28
from Mailman.i18n import _
 
29
 
 
30
def convert(mlist):
 
31
    for attr in ('msg_header', 'msg_footer', 'digest_header', 'digest_footer',
 
32
                 'autoresponse_postings_text', 'autoresponse_admin_text',
 
33
                 'autoresponse_request_text'):
 
34
        s = getattr(mlist, attr)
 
35
        t = Utils.to_dollar(s)
 
36
        setattr(mlist, attr, t)
 
37
    mlist.use_dollar_strings = 1
 
38
    print _('Saving list')
 
39
    mlist.Save()
 
40
 
 
41
 
 
42
 
 
43
if __name__ == '__main__':
 
44
    print _(__doc__.replace('%', '%%'))