Added some immutable field (platform) in default runtime web setting page, for the example. nevow_service_rework
authorEdouard Tisserant
Fri, 06 Jul 2018 15:07:40 +0200
branchnevow_service_rework
changeset 2217 a603d1ba287b
parent 2216 8ae29ec2d1dc
child 2218 7a4deed94eb2
Added some immutable field (platform) in default runtime web setting page, for the example.
runtime/NevowServer.py
--- a/runtime/NevowServer.py	Fri Jul 06 15:05:03 2018 +0200
+++ b/runtime/NevowServer.py	Fri Jul 06 15:07:40 2018 +0200
@@ -26,6 +26,7 @@
 from __future__ import absolute_import
 from __future__ import print_function
 import os
+import platform
 from zope.interface import implements
 from nevow import appserver, inevow, tags, loaders, athena, url, rend
 from nevow.page import renderer
@@ -141,8 +142,8 @@
             return annotate.MethodBinding(
                 'action_'+name,
                 annotate.Method(arguments=[
-                    annotate.Argument(name, fieldtype)
-                    for fieldname,fieldtype in fields],
+                    annotate.Argument(*field)
+                    for field in fields],
                     label = desc),
                 action = btnlabel)
         setattr(self, 'bind_'+name, _bind)
@@ -154,6 +155,11 @@
 ConfigurableSettings = ConfigurableBindings()
 
 class ISettings(annotate.TypedInterface):
+    platform = annotate.String(label = _("Platform"),
+                           default = platform.system() + " " + platform.release(),
+                           immutable = True)
+    # TODO version ?
+
     def sendLogMessage(
         ctx = annotate.Context(),
         level = annotate.Choice(LogLevels,