Runtime web settings: allow customization of version string by extensions
authorEdouard Tisserant
Thu, 09 Nov 2023 11:20:39 +0100
changeset 3855 beccb995b10e
parent 3837 efe0b5b21842
child 3856 054c4f1b2ea7
Runtime web settings: allow customization of version string by extensions
runtime/NevowServer.py
--- a/runtime/NevowServer.py	Fri Aug 18 11:38:20 2023 +0200
+++ b/runtime/NevowServer.py	Thu Nov 09 11:20:39 2023 +0100
@@ -196,10 +196,19 @@
     global extensions_settings_od
     extensions_settings_od.pop(token)
 
+
+def originalGetVersions():
+    return platform_module.system() + " " + platform_module.release()
+
+_getVersions = originalGetVersions
+
+def setVersionsCallable(versionsCallable):
+    global _getVersions
+    _getVersions = versionsCallable
+
 class ISettings(annotate.TypedInterface):
     platform = annotate.String(label=_("Platform"),
-                               default=platform_module.system() +
-                               " " + platform_module.release(),
+                               default=lambda *a,**k:_getVersions(),
                                immutable=True)
 
     # TODO version ?