Added a way for extension to register dedicated URL under settings page URL (i.e. /settings/something) nevow_service_rework
authorEdouard Tisserant
Tue, 10 Jul 2018 12:51:28 +0200
branchnevow_service_rework
changeset 2219 73042b2d8d65
parent 2218 7a4deed94eb2
child 2220 985f234b0d09
Added a way for extension to register dedicated URL under settings page URL (i.e. /settings/something)
runtime/NevowServer.py
--- a/runtime/NevowServer.py	Fri Jul 06 15:09:44 2018 +0200
+++ b/runtime/NevowServer.py	Tue Jul 10 12:51:28 2018 +0200
@@ -171,6 +171,8 @@
                                            label=_("Send a message to the log"),
                                            action=_("Send"))
 
+customSettingsURLs = {
+}
 
 class SettingsPage(rend.Page):
     # We deserve a slash
@@ -196,9 +198,6 @@
                                        webform.renderForms('dynamicSettings'),
                                    ]]])
 
-    def __init__(self):
-        rend.Page.__init__(self)
-
     def configurable_staticSettings(self, ctx):
         return configurable.TypedInterfaceConfigurable(self)
 
@@ -210,6 +209,11 @@
         if _PySrv.plcobj is not None:
             _PySrv.plcobj.LogMessage(level, "Web form log message: " + message )
 
+    def locateChild(self, ctx, segments):
+        if segments[0] in customSettingsURLs :
+            return customSettingsURLs[segments[0]](ctx, segments)
+        return super(SettingsPage, self).locateChild(ctx, segments)
+
 
 class WebInterface(athena.LivePage):