1#! @PYTHON@ 2# 3# Copyright (C) 2002-2018 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 19"""Convert a list's interpolation strings from %-strings to $-strings. 20 21This script is intended to be run as a bin/withlist script, i.e. 22 23% bin/withlist -l -r convert <mylist> 24""" 25 26import paths 27from Mailman import Utils 28from Mailman.i18n import C_ 29 30def 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 C_('Saving list') 39 mlist.Save() 40 41 42 43if __name__ == '__main__': 44 print C_(__doc__.replace('%', '%%')) 45