Author: dmeyer
Date: Mon Nov  6 14:37:51 2006
New Revision: 1980

Modified:
   trunk/popcorn/src/utils/ipc.py

Log:
autodetect set_* command and set variable

Modified: trunk/popcorn/src/utils/ipc.py
==============================================================================
--- trunk/popcorn/src/utils/ipc.py      (original)
+++ trunk/popcorn/src/utils/ipc.py      Mon Nov  6 14:37:51 2006
@@ -87,10 +87,20 @@
         if line and line.startswith("!kaa!"):
             # ipc command from child
             command, args, kwargs = eval(line[5:])
-            getattr(self._parent, "_child_" + command)(*args, **kwargs)
-        else:
-            # same debug
-            log.info("[%s-%d] %s", self._name, self._child.child.pid, line)
+            cmd = getattr(self._parent, "_child_" + command, None)
+            if cmd:
+                cmd(*args, **kwargs)
+                return True
+            if command.startswith('set_'):
+               if hasattr(self._parent, command[3:]) and args:
+                   setattr(self._parent, command[3:], args[0])
+                   return True
+               if hasattr(self._parent, command[4:]) and args:
+                   setattr(self._parent, command[4:], args[0])
+                   return True
+            raise AttributeError('parent has no attribute %s', command)
+        # some debug
+        log.info("[%s-%d] %s", self._name, self._child.child.pid, line)
 
 
     def __getattr__(self, attr):
@@ -153,3 +163,8 @@
             self._stdin_data = self._stdin_data[self._stdin_data.find('\n')+1:]
             command, args, kwargs = eval(line)
             reply = getattr(self, command)(*args, **kwargs)
+
+
+    def die(self):
+        sys.exit(0)
+        

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to