python3: remove "execfile", which isn't a builtin anymore (#31145)

This commit is contained in:
Paul Marillonnet 2019-03-06 17:35:56 +01:00
parent e2d868a684
commit 6d856ad3ca
10 changed files with 25 additions and 14 deletions

View File

@ -303,7 +303,8 @@ extract_settings_from_environ()
CONFIG_FILE = '/etc/authentic2/config.py'
if os.path.exists(CONFIG_FILE):
execfile(CONFIG_FILE)
with open(CONFIG_FILE) as fd:
exec(fd.read())
# Warn if DEFAULT_FROM_EMAIL is the default value
if DEFAULT_FROM_EMAIL == 'webmaster@localhost':

View File

@ -9,7 +9,7 @@
# WARNING! Quick-start development settings unsuitable for production!
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
# This file is sourced by "execfile" from /usr/lib/authentic/debian_config.py
# This file is sourced by "exec" from /usr/lib/authentic/debian_config.py
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False

View File

@ -9,7 +9,8 @@ PROJECT_NAME = 'authentic2-multitenant'
#
# hobotization (multitenant)
#
execfile('/usr/lib/hobo/debian_config_common.py')
with open('/usr/lib/hobo/debian_config_common.py') as fd:
exec(fd.read())
# Add the XForwardedForMiddleware
MIDDLEWARE_CLASSES = ('authentic2.middleware.XForwardedForMiddleware',) + MIDDLEWARE_CLASSES
@ -50,7 +51,9 @@ HOBO_SKELETONS_DIR = os.path.join(VAR_DIR, 'skeletons')
CONFIG_FILE='/etc/%s/config.py' % PROJECT_NAME
if os.path.exists(CONFIG_FILE):
execfile(CONFIG_FILE)
with open(CONFIG_FILE) as fd:
exec(fd.read())
# run additional settings snippets
execfile('/usr/lib/hobo/debian_config_settings_d.py')
with open('/usr/lib/hobo/debian_config_settings_d.py') as fd:
exec(fd.read())

View File

@ -309,7 +309,8 @@ extract_settings_from_environ()
CONFIG_FILE = '/etc/authentic2/config.py'
if os.path.exists(CONFIG_FILE):
execfile(CONFIG_FILE)
with open(CONFIG_FILE) as fd:
exec(fd.read())
# Warn if DEFAULT_FROM_EMAIL is the default value
if DEFAULT_FROM_EMAIL == 'webmaster@localhost':

View File

@ -9,7 +9,7 @@
# WARNING! Quick-start development settings unsuitable for production!
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
# This file is sourced by "execfile" from
# This file is sourced by "exec" from
# /usr/lib/authentic2-multitenant/debian_config.py
# SECURITY WARNING: don't run with debug turned on in production!

View File

@ -9,7 +9,8 @@ PROJECT_NAME = 'authentic2-multitenant'
#
# hobotization (multitenant)
#
execfile('/usr/lib/hobo/debian_config_common.py')
with open('/usr/lib/hobo/debian_config_common.py') as fd:
exec(fd.read())
# Add the XForwardedForMiddleware
MIDDLEWARE_CLASSES = ('authentic2.middleware.XForwardedForMiddleware',) + MIDDLEWARE_CLASSES
@ -49,7 +50,9 @@ HOBO_SKELETONS_DIR = os.path.join(VAR_DIR, 'skeletons')
CONFIG_FILE='/etc/%s/config.py' % PROJECT_NAME
if os.path.exists(CONFIG_FILE):
execfile(CONFIG_FILE)
with open(CONFIG_FILE) as fd:
exec(fd.read())
# run additional settings snippets
execfile('/usr/lib/hobo/debian_config_settings_d.py')
with open('/usr/lib/hobo/debian_config_settings_d.py') as fd:
exec(fd.read())

View File

@ -3,7 +3,7 @@
# Authentic2 documentation build configuration file, created by
# sphinx-quickstart on Thu Oct 13 14:38:32 2011.
#
# This file is execfile()d with the current directory set to its containing dir.
# This file is exec()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.

View File

@ -26,7 +26,8 @@ class DjangoUserLDIFParser(ldif.LDIFParser):
self.callback = None
if 'callback' in self.options:
d = globals().copy()
execfile(self.options['callback'], d)
with open(self.options['callback'], d) as fd:
exec(fd.read())
self.callback = d.get('callback')
ldif.LDIFParser.__init__(self, *args, **kwargs)

View File

@ -333,5 +333,6 @@ SELECT2_CSS = xstatic('select2', 'select2.min.css')
#
if 'AUTHENTIC2_SETTINGS_FILE' in os.environ:
execfile(os.environ['AUTHENTIC2_SETTINGS_FILE'])
with open(os.environ['AUTHENTIC2_SETTINGS_FILE']) as fd:
exec(fd.read())
logging.config.dictConfig(LOGGING)

View File

@ -21,4 +21,5 @@ import os
ALLOWED_HOSTS = []
if 'AUTHENTIC2_SETTINGS_FILE' in os.environ:
execfile(os.environ['AUTHENTIC2_SETTINGS_FILE'])
with open(os.environ['AUTHENTIC2_SETTINGS_FILE']) as fd:
exec(fd.read())