Imported Upstream version 4.0.5

This commit is contained in:
Mario Fetka
2021-07-25 07:50:50 +02:00
parent 8ff3be4216
commit 3bfaa6e020
2049 changed files with 317193 additions and 1632423 deletions

View File

@@ -21,35 +21,32 @@
Plugin index generation script
"""
import logging
import os
from ipaplatform.paths import paths
from ipapython.ipa_log_manager import root_logger
logger = logging.getLogger(os.path.basename(__file__))
PLUGINS_DIR = paths.IPA_JS_PLUGINS_DIR
def get_plugin_index():
if not os.path.isdir(paths.IPA_JS_PLUGINS_DIR):
if not os.path.isdir(PLUGINS_DIR):
raise Exception("Supplied plugin directory path is not a directory")
dirs = os.listdir(paths.IPA_JS_PLUGINS_DIR)
dirs = os.listdir(PLUGINS_DIR)
index = 'define([],function(){return['
index += ','.join("'"+x+"'" for x in dirs)
index += '];});'
return index.encode('utf-8')
return index
def get_failed():
return (
b'define([],function(){return[];});/*error occured: serving default */'
)
return 'define([],function(){return[];});/*error occured: serving default */'
def application(environ, start_response):
try:
index = get_plugin_index()
status = '200 OK'
except Exception as e:
logger.error('plugin index generation failed: %s', e)
except Exception, e:
root_logger.error('plugin index generation failed: %s' % e)
status = '200 OK'
index = get_failed()
headers = [('Content-type', 'application/javascript'),