runtime/NevowServer.py
branchnevow_service_rework
changeset 2219 73042b2d8d65
parent 2217 a603d1ba287b
child 2246 51047284cb0e
child 2266 ed415982a9aa
equal deleted inserted replaced
2218:7a4deed94eb2 2219:73042b2d8d65
   169             pass
   169             pass
   170     sendLogMessage = annotate.autocallable(sendLogMessage, 
   170     sendLogMessage = annotate.autocallable(sendLogMessage, 
   171                                            label=_("Send a message to the log"),
   171                                            label=_("Send a message to the log"),
   172                                            action=_("Send"))
   172                                            action=_("Send"))
   173 
   173 
       
   174 customSettingsURLs = {
       
   175 }
   174 
   176 
   175 class SettingsPage(rend.Page):
   177 class SettingsPage(rend.Page):
   176     # We deserve a slash
   178     # We deserve a slash
   177     addSlash = True
   179     addSlash = True
   178     
   180     
   194                                        webform.renderForms('staticSettings'),
   196                                        webform.renderForms('staticSettings'),
   195                                        tags.h2["Extensions settings:"],
   197                                        tags.h2["Extensions settings:"],
   196                                        webform.renderForms('dynamicSettings'),
   198                                        webform.renderForms('dynamicSettings'),
   197                                    ]]])
   199                                    ]]])
   198 
   200 
   199     def __init__(self):
       
   200         rend.Page.__init__(self)
       
   201 
       
   202     def configurable_staticSettings(self, ctx):
   201     def configurable_staticSettings(self, ctx):
   203         return configurable.TypedInterfaceConfigurable(self)
   202         return configurable.TypedInterfaceConfigurable(self)
   204 
   203 
   205     def configurable_dynamicSettings(self, ctx):
   204     def configurable_dynamicSettings(self, ctx):
   206         return ConfigurableSettings
   205         return ConfigurableSettings
   207     
   206     
   208     def sendLogMessage(self, level, message, **kwargs):
   207     def sendLogMessage(self, level, message, **kwargs):
   209         level = LogLevelsDict[level]
   208         level = LogLevelsDict[level]
   210         if _PySrv.plcobj is not None:
   209         if _PySrv.plcobj is not None:
   211             _PySrv.plcobj.LogMessage(level, "Web form log message: " + message )
   210             _PySrv.plcobj.LogMessage(level, "Web form log message: " + message )
       
   211 
       
   212     def locateChild(self, ctx, segments):
       
   213         if segments[0] in customSettingsURLs :
       
   214             return customSettingsURLs[segments[0]](ctx, segments)
       
   215         return super(SettingsPage, self).locateChild(ctx, segments)
   212 
   216 
   213 
   217 
   214 class WebInterface(athena.LivePage):
   218 class WebInterface(athena.LivePage):
   215 
   219 
   216     docFactory = loaders.stan([tags.raw(xhtml_header),
   220     docFactory = loaders.stan([tags.raw(xhtml_header),