# Copyright (C) 2017 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, # USA. """Change the web_page_url scheme to https for all lists. Save as bin/https.py Run via bin/withlist -a -r https The standard fix_url.py script can do this and also update host_name if necessary after changing DEFAULT_URL_PATTERN, but in an environment with multiple virtual domains, fix_url must be run separately for each domain. This script will do all lists at once without regard to domain. """ import re def https(mlist): if not mlist.Locked(): mlist.Lock() if re.search('^http:', mlist.web_page_url): mlist.web_page_url = re.sub('^http:', 'https:', mlist.web_page_url) print('list: %s: changed web_page_url to %s' % (mlist.real_name, mlist.web_page_url)) mlist.Save() mlist.Unlock()