fix BS with not existing session
authorRico Schulte <ricoschulte@users.schwerkraft.elitedvb.net>
Thu, 5 Jul 2007 19:43:27 +0000 (19:43 +0000)
committerRico Schulte <ricoschulte@users.schwerkraft.elitedvb.net>
Thu, 5 Jul 2007 19:43:27 +0000 (19:43 +0000)
got BS with "global name session is not defined" so i catched it, but please make it safe if you use globals!

thx

webinterface/src/plugin.py

index f3a9aea..460e02c 100644 (file)
@@ -41,9 +41,11 @@ DEBUGFILE= "/tmp/twisted.log"
 
 def stopWebserver(session):
        reactor.disconnectAll()
-       del session.mediaplayer
-       del session.messageboxanswer
-
+       try:# got BS with "global name session is not defined" so i catched it, but please make it safe if you use globals! thx
+               del session.mediaplayer
+               del session.messageboxanswer
+       except NameError:
+               pass
 def restartWebserver(session):
        stopWebserver(session)
        startWebserver(session)