moved unittests for (formerly) internal pages to the appropriate plugins
added "do_unittests.sh" - this script should be used to run all unittests before commit fixed nasty "cannot-switch-languages"-bug fixed language data loading for plugins
This commit is contained in:
parent
e42902f641
commit
ada7458306
8 changed files with 91 additions and 34 deletions
|
@ -12,6 +12,7 @@ class WebInterfacePlugins:
|
|||
def __init__(self, log, plugins, handler_func):
|
||||
for plugin in plugins.getPlugins():
|
||||
if not plugin: continue
|
||||
if not plugin.isEnabled(): continue
|
||||
plname = plugin.getName()
|
||||
log.info("Plugin '%s' loaded" % plname)
|
||||
## this should be the "easiest" way to expose all plugins as URLs
|
||||
|
@ -114,18 +115,21 @@ class WebInterfaceSites:
|
|||
def index(self, weblang=""):
|
||||
self.__resetDataset()
|
||||
self.__setWebLang(weblang)
|
||||
## do not forget the language!
|
||||
param_dict = {"weblang":weblang}
|
||||
## render "disks" plugin by default
|
||||
return self.return_plugin_action(self.pluginList.getPlugin("disks"))()
|
||||
return self.return_plugin_action(self.pluginList.getPlugin("disks"))(**param_dict)
|
||||
|
||||
|
||||
def return_plugin_action(self, plugin):
|
||||
def handler(self, **args):
|
||||
self.__resetDataset()
|
||||
args_orig = dict(args)
|
||||
try:
|
||||
self.__setWebLang(args["weblang"])
|
||||
del args["weblang"]
|
||||
except KeyError:
|
||||
pass
|
||||
self.__setWebLang("")
|
||||
## check the device argument of volume plugins
|
||||
if "volume" in plugin.pluginCapabilities:
|
||||
try:
|
||||
|
@ -155,7 +159,9 @@ class WebInterfaceSites:
|
|||
and "plugin" in nextTemplate.keys() \
|
||||
and "values" in nextTemplate.keys() \
|
||||
and self.pluginList.getPlugin(nextTemplate["plugin"]):
|
||||
valueDict = nextTemplate["values"]
|
||||
valueDict = dict(nextTemplate["values"])
|
||||
## force the current weblang attribute - otherwise it gets lost
|
||||
valueDict["weblang"] = self.dataset["Settings.Language"]
|
||||
new_plugin = self.pluginList.getPlugin(nextTemplate["plugin"])
|
||||
return self.return_plugin_action(new_plugin)(**valueDict)
|
||||
## save the currently active plugin name
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue