Fixed Nevow website startup
authorEdouard Tisserant
Fri, 27 Feb 2015 00:40:44 +0100
changeset 1453 f31353cac197
parent 1452 7a2b344de8cf
child 1454 29b02164e65d
child 1456 e723c1dd6faa
Fixed Nevow website startup
Beremiz_service.py
runtime/NevowServer.py
--- a/Beremiz_service.py	Wed Feb 25 14:00:11 2015 +0100
+++ b/Beremiz_service.py	Fri Feb 27 00:40:44 2015 +0100
@@ -514,6 +514,7 @@
         except Exception, e:
             print "Nevow/Athena import failed :", e
             webport = None
+        NS.WorkingDir = WorkingDir
 
     if wampconf is not None :
         try:
--- a/runtime/NevowServer.py	Wed Feb 25 14:00:11 2015 +0100
+++ b/runtime/NevowServer.py	Fri Feb 27 00:40:44 2015 +0100
@@ -9,6 +9,8 @@
 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 '''
 
+WorkingDir = None
+
 class PLCHMI(athena.LiveElement):
 
     initialised = False
@@ -162,8 +164,9 @@
 
     def listen(self, state):
         if state != self.oldstate:
-            {'Started': self.site.PLCStarted,
-            'Stopped': self.site.PLCStopped}[state]()
+            action = {'Started': self.site.PLCStarted,
+                      'Stopped': self.site.PLCStopped}.get(state, None)
+            if action is not None: action ()
             self.oldstate = state
 
 def website_statuslistener_factory(site):