--- a/runtime/NevowServer.py Fri Jun 22 12:43:33 2018 +0200
+++ b/runtime/NevowServer.py Fri Jun 22 14:08:34 2018 +0200
@@ -31,6 +31,7 @@
from nevow.page import renderer
from formless import annotate
from formless import webform
+from formless import configurable from twisted.internet import reactor
import util.paths as paths
@@ -140,6 +141,36 @@
+class ConfigurableBindings(configurable.Configurable): + configurable.Configurable.__init__(self, None) + self.bindingsNames = [] + def getBindingNames(self, ctx): + return self.bindingsNames + def addExtension(self, name, desc, fields, callback): + print(name, fields, callback) + return annotate.MethodBinding( + annotate.Method(arguments=[ + annotate.Argument(name, fieldtype) + for fieldname,fieldtype in fields], + setattr(self, 'bind_'+name, _bind) + setattr(self, 'action_'+name, _action) + self.bindingsNames.append(name) +ConfigurableSettings = ConfigurableBindings() class ISettings(annotate.TypedInterface):
ctx = annotate.Context(),
@@ -154,7 +185,7 @@
DNS = annotate.String(label=_("DNS address"),default=defaultVal('net'))):
- networkConfig = annotate.autocallable(networkConfig, label=_("Network settings"), action="Set", )
+ networkConfig = annotate.autocallable(networkConfig, label=_("Network settings"), action=_("Set")) class SettingsPage(rend.Page):
@@ -166,10 +197,6 @@
- def networkConfig(*args, **kwargs):
- lastKnownConfig['net'] = kwargs
docFactory = loaders.stan([tags.html[
@@ -179,9 +206,30 @@
href=url.here.child("webform_css"))
+ tags.h1["Runtime settings:"], + webform.renderForms('staticSettings'), + tags.h2["Extensions settings:"], + webform.renderForms('dynamicSettings'), + rend.Page.__init__(self) + def configurable_staticSettings(self, ctx): + return configurable.TypedInterfaceConfigurable(self) + def configurable_dynamicSettings(self, ctx): + return ConfigurableSettings + def networkConfig(self, *args, **kwargs): + lastKnownConfig['net'] = kwargs + ConfigurableSettings.addExtension( + [("Host",annotate.String(label=_("IP address")))], class WebInterface(athena.LivePage):