@@ -41,10 +41,12 @@ def _put_configuration_defaults(config):
4141 :param config: the basic configuration as a dict
4242 :return: the same dict, but with defaults for some unfilled parameters
4343 """
44- if 'allowed_file_extensions' not in config :
45- config ['allowed_file_extensions' ] = [".c" , ".cpp" , ".java" , ".oz" , ".zip" , ".tar.gz" , ".tar.bz2" , ".txt" ]
46- if 'max_file_size' not in config :
47- config ['max_file_size' ] = 1024 * 1024
44+ config ["ALLOWED_FILE_EXTENSIONS" ] = config .get (
45+ 'allowed_file_extensions' ,
46+ [".c" , ".cpp" , ".java" , ".oz" , ".zip" , ".tar.gz" , ".tar.bz2" , ".txt" ]
47+ )
48+
49+ config ["MAX_FILE_SIZE" ] = config .get ('max_file_size' , 1024 * 1024 )
4850
4951 if 'session_parameters' not in config or 'secret_key' not in config ['session_parameters' ]:
5052 print ("Please define a secret_key in the session_parameters part of the configuration." , file = sys .stderr )
@@ -61,6 +63,7 @@ def _put_configuration_defaults(config):
6163
6264 if 'session_parameters' not in config :
6365 config ['session_parameters' ] = {}
66+
6467 default_session_parameters = {
6568 "cookie_name" : "inginious_session_id" ,
6669 "cookie_domain" : None ,
@@ -93,6 +96,7 @@ def _put_configuration_defaults(config):
9396 config ["MAIL_PASSWORD" ] = smtp_conf .get ("password" , None )
9497 config [
"MAIL_DEFAULT_SENDER" ]
= smtp_conf .
get (
"sendername" ,
"[email protected] " )
9598
99+ config ["STATIC_DIRECTORY" ] = config .get ("static_directory" , "./static" )
96100 config ["SUPERADMINS" ] = config .get ("superadmins" , [])
97101 config ["ALLOW_DELETION" ] = config .get ("allow_deletion" , True )
98102 config ["ALLOW_REGISTRATION" ] = config .get ("allow_registration" , True )
@@ -195,7 +199,6 @@ def get_app(config):
195199 flask_app .jinja_env .globals ["get_homepath" ] = get_homepath
196200 flask_app .jinja_env .globals ["get_path" ] = get_path
197201 flask_app .jinja_env .globals ["pkg_version" ] = __version__
198- flask_app .jinja_env .globals ["sentry_io_url" ] = config .get ("SENTRY_IO_URL" )
199202 flask_app .jinja_env .globals ["user_manager" ] = user_manager
200203 flask_app .jinja_env .globals ["is_tos_defined" ] = flask_app .is_tos_defined
201204
@@ -229,8 +232,6 @@ def flask_internalerror(e):
229232 flask_app .client = client
230233 flask_app .available_languages = available_languages
231234 flask_app .available_indentation_types = available_indentation_types
232- flask_app .welcome_page = config .get ("WELCOME_PAGE" , None )
233- flask_app .static_directory = config .get ("STATIC_DIRECTORY" , "./static" )
234235
235236 # Init the mapping of the app
236237 if config .get ("MAINTENANCE" , False ):
0 commit comments