Module: check_mk
Branch: master
Commit: c734c655e0152dc1a4371df4ed07425a952d6f0c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c734c655e0152d…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Sat Jun 10 13:01:25 2017 +0200
Minor cleanup: register page handler through function call
---
web/htdocs/modules.py | 6 +++++-
web/plugins/pages/bi.py | 6 +++---
web/plugins/pages/cron.py | 2 +-
web/plugins/pages/guitester.py | 2 +-
web/plugins/pages/metrics.py | 2 +-
web/plugins/pages/mobile.py | 2 +-
web/plugins/pages/shipped.py | 4 +---
web/plugins/pages/wato.py | 2 +-
8 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/web/htdocs/modules.py b/web/htdocs/modules.py
index 3452780..6bf3879 100644
--- a/web/htdocs/modules.py
+++ b/web/htdocs/modules.py
@@ -125,12 +125,16 @@ def load_all_plugins():
# Install page handlers created by the pagetypes.py modules. It is allowed for all
# kind of plugins to register own page types, so we need to wait after all plugins
# have been loaded to update the pagehandlers
- pagehandlers.update(pagetypes.page_handlers())
+ register_handlers(pagetypes.page_handlers())
# Mark the modules as loaded after all plugins have been loaded. In case of
exceptions
# we want them to occur again on subsequent requests too.
g_all_modules_loaded = True
+def register_handlers(handlers):
+ pagehandlers.update(handlers)
+
+
def get_handler(name, dflt=None):
return pagehandlers.get(name, dflt)
diff --git a/web/plugins/pages/bi.py b/web/plugins/pages/bi.py
index 4d04206..24fbacf 100644
--- a/web/plugins/pages/bi.py
+++ b/web/plugins/pages/bi.py
@@ -26,9 +26,9 @@
import bi
-pagehandlers.update({
- "bi_debug" : bi.page_debug,
- "bi" : bi.page_all,
+register_handlers({
+ "bi_debug" : bi.page_debug,
+ "bi" : bi.page_all,
"bi_set_assumption" : bi.ajax_set_assumption,
"bi_save_treestate" : bi.ajax_save_treestate,
"bi_render_tree" : bi.ajax_render_tree,
diff --git a/web/plugins/pages/cron.py b/web/plugins/pages/cron.py
index 12b0ba6..4860595 100644
--- a/web/plugins/pages/cron.py
+++ b/web/plugins/pages/cron.py
@@ -26,6 +26,6 @@
import cron
-pagehandlers.update({
+register_handlers({
"noauth:run_cron" : cron.page_run_cron,
})
diff --git a/web/plugins/pages/guitester.py b/web/plugins/pages/guitester.py
index b187706..033f713 100644
--- a/web/plugins/pages/guitester.py
+++ b/web/plugins/pages/guitester.py
@@ -26,6 +26,6 @@
import guitester
-pagehandlers.update({
+register_handlers({
"guitest_reschedule_all" : guitester.page_reschedule_all,
})
diff --git a/web/plugins/pages/metrics.py b/web/plugins/pages/metrics.py
index 15e47f1..96ca479 100644
--- a/web/plugins/pages/metrics.py
+++ b/web/plugins/pages/metrics.py
@@ -26,6 +26,6 @@
import metrics
-pagehandlers.update({
+register_handlers({
"noauth:pnp_template" : metrics.page_pnp_template,
})
diff --git a/web/plugins/pages/mobile.py b/web/plugins/pages/mobile.py
index 1aa70d8..2a2e941 100644
--- a/web/plugins/pages/mobile.py
+++ b/web/plugins/pages/mobile.py
@@ -26,7 +26,7 @@
import mobile
-pagehandlers.update({
+register_handlers({
"mobile" : mobile.page_index,
"mobile_view" : mobile.page_view,
})
diff --git a/web/plugins/pages/shipped.py b/web/plugins/pages/shipped.py
index 0d9da17..2e17b3d 100644
--- a/web/plugins/pages/shipped.py
+++ b/web/plugins/pages/shipped.py
@@ -47,10 +47,8 @@ import inventory
import notifications
import valuespec
-
# map URLs to page rendering functions
-
-pagehandlers.update({
+register_handlers({
"index" : main.page_index,
"login" : login.page_login,
"logout" : login.page_logout,
diff --git a/web/plugins/pages/wato.py b/web/plugins/pages/wato.py
index 3e36c0f..c7afcef 100644
--- a/web/plugins/pages/wato.py
+++ b/web/plugins/pages/wato.py
@@ -26,7 +26,7 @@
import wato
-pagehandlers.update({
+register_handlers({
"wato" : wato.page_handler,
"ajax_start_activation" : lambda:
wato.ModeAjaxStartActivation().handle_page(),