Author: tack
Date: Sat Apr 29 14:55:39 2006
New Revision: 1526
Modified:
trunk/base/src/notifier/__init__.py
trunk/base/src/notifier/callback.py
Log:
Change signal emit default return value to True, if any handlers return
False then emit will return False. Removed step signal wrapper and pass the
emit method directly to notifier again. (If any step signal handlers return
False this dispatcher will get removed, but that's not a big deal, we just make
sure we don't do that).
Modified: trunk/base/src/notifier/__init__.py
==============================================================================
--- trunk/base/src/notifier/__init__.py (original)
+++ trunk/base/src/notifier/__init__.py Sat Apr 29 14:55:39 2006
@@ -58,19 +58,11 @@
# Set if currently in shutdown() (to prevent reentrancy)
shutting_down = False
-def _step_signal_emit():
- """
- Wrapper for idle signal emit that ignores return value, otherwise notifier
- may remove the dispatcher if the signal returns false.
- """
- signals["step"].emit()
- return True
-
def _step_signal_changed(signal, flag):
if flag == Signal.SIGNAL_CONNECTED and signal.count() == 1:
- notifier.dispatcher_add(_step_signal_emit)
+ notifier.dispatcher_add(signals["step"].emit)
elif flag == Signal.SIGNAL_DISCONNECTED and signal.count() == 0:
- notifier.dispatcher_remove(_step_signal_emit)
+ notifier.dispatcher_remove(signals["step"].emit)
signals = {
Modified: trunk/base/src/notifier/callback.py
==============================================================================
--- trunk/base/src/notifier/callback.py (original)
+++ trunk/base/src/notifier/callback.py Sat Apr 29 14:55:39 2006
@@ -448,10 +448,15 @@
self._changed_cb(self, Signal.SIGNAL_DISCONNECTED)
def emit(self, *args, **kwargs):
+ """
+ Emits the signal, passing the args and kwargs to each signal handler.
+ The default return value is True, but if any of the signal handlers
+ return False, this method will return False.
+ """
if len(self._callbacks) == 0:
- return False
+ return True
- retval = False
+ retval = True
for cb_callback, cb_args, cb_kwargs, cb_once, cb_weak in
self._callbacks[:]:
if cb_weak:
cb_callback_u = cb_callback._get_callback()
@@ -470,8 +475,8 @@
if cb_once:
self.disconnect(cb_callback, *cb_args, **cb_kwargs)
cb_kwargs.update(kwargs)
- if cb_callback(*(args + cb_args), **cb_kwargs):
- retval = True
+ if cb_callback(*(args + cb_args), **cb_kwargs) == False:
+ retval = False
return retval
-------------------------------------------------------
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