[ create a new paste ] login | about

Link: http://codepad.org/d9YVuvoR    [ raw code | fork ]

Python, pasted on Dec 17:
diff --git a/circuits/core/manager.py b/circuits/core/manager.py
--- a/circuits/core/manager.py
+++ b/circuits/core/manager.py
@@ -33,6 +33,10 @@
 TIMEOUT = 0.1  # 100ms timeout when idle
 
 
+class TimeoutError(Exception):
+    """Raised for events that timedout while waiting/calling"""
+
+
 class UnregistrableError(Exception):
     """Raised if a component cannot be registered as child."""
 
@@ -415,9 +419,13 @@
         def _on_tick(self):
             if state['timeout'] == 0:
                 self.registerTask((state['task_event'],
-                                   state['task'],
+                                   state["task"],
                                    state['parent']))
+                raise TimeoutError(state["task_event"])
+
+            print("...")
             state['timeout'] -= 1
+            print state["timeout"]
 
         if not channels:
             channels = (None, )
@@ -434,7 +442,7 @@
         yield state
 
         self.removeHandler(_on_done_handler, "%s_done" % event)
-        if state['timeout'] >= 0:
+        if state['timeout'] > 0:
             self.removeHandler(_on_tick_handler, "generate_events")
 
         if state["event"] is not None:
@@ -700,6 +708,8 @@
                 # self.registerTask((event, value, task))
             elif value is not None:
                 event.value.value = value
+            elif isinstnace(value, Exceptino):
+                raise(value)
         except StopIteration:
             event.waitingHandlers -= 1
             self.unregisterTask((event, task, parent))


Create a new paste based on this one


Comments: