Imported Upstream version 4.8.10

This commit is contained in:
Mario Fetka
2021-10-03 11:06:28 +02:00
parent 10dfc9587b
commit 03a8170b15
2361 changed files with 1883897 additions and 338759 deletions

View File

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