You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2015/01/26 12:29:33 UTC

[2/2] qpid-proton git commit: Fix duplicated events caused by changes to dispatch function; no longer need to flatten nested handlers

Fix duplicated events caused by changes to dispatch function; no longer need to flatten nested handlers


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/1702665d
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/1702665d
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/1702665d

Branch: refs/heads/master
Commit: 1702665dfbf306ebbada1905a7820e5592759797
Parents: 647113c
Author: Gordon Sim <gs...@redhat.com>
Authored: Mon Jan 26 11:30:39 2015 +0000
Committer: Gordon Sim <gs...@redhat.com>
Committed: Mon Jan 26 11:30:39 2015 +0000

----------------------------------------------------------------------
 proton-c/bindings/python/proton/handlers.py | 11 +----------
 proton-c/bindings/python/proton/reactors.py |  4 ++--
 2 files changed, 3 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1702665d/proton-c/bindings/python/proton/handlers.py
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/proton/handlers.py b/proton-c/bindings/python/proton/handlers.py
index e403d26..b2548fb 100644
--- a/proton-c/bindings/python/proton/handlers.py
+++ b/proton-c/bindings/python/proton/handlers.py
@@ -50,15 +50,6 @@ class FlowController(Handler):
         if event.delivery.link.is_receiver:
             self.top_up(event.delivery.link)
 
-def nested_handlers(handlers):
-    # currently only allows for a single level of nesting
-    nested = []
-    for h in handlers:
-        nested.append(h)
-        if hasattr(h, 'handlers'):
-            nested.extend(getattr(h, 'handlers'))
-    return nested
-
 def add_nested_handler(handler, nested):
     if hasattr(handler, 'handlers'):
         getattr(handler, 'handlers').append(nested)
@@ -80,7 +71,7 @@ class ScopedHandler(Handler):
 
         objects = [getattr(event, attr) for attr in self.scopes if hasattr(event, attr) and getattr(event, attr)]
         targets = [getattr(o, "context") for o in objects if hasattr(o, "context")]
-        handlers = [getattr(t, event.type.method) for t in nested_handlers(targets) if hasattr(t, event.type.method)]
+        handlers = [getattr(t, event.type.method) for t in targets if hasattr(t, event.type.method)]
         for h in handlers:
             h(event)
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1702665d/proton-c/bindings/python/proton/reactors.py
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/proton/reactors.py b/proton-c/bindings/python/proton/reactors.py
index de9752e..77b49cd 100644
--- a/proton-c/bindings/python/proton/reactors.py
+++ b/proton-c/bindings/python/proton/reactors.py
@@ -23,7 +23,7 @@ from proton import Endpoint, Event, EventBase, EventType, generate_uuid, Handler
 from proton import ProtonException, PN_ACCEPTED, PN_PYREF, SASL, Session, symbol
 from proton import Terminus, Timeout, Transport, TransportException, ulong, Url
 from select import select
-from proton.handlers import nested_handlers, OutgoingMessageHandler, ScopedHandler
+from proton.handlers import OutgoingMessageHandler, ScopedHandler
 
 class AmqpSocket(object):
     """
@@ -721,7 +721,7 @@ class Urls(object):
 class Container(object):
     def __init__(self, *handlers):
         h = [Connector(self), ScopedHandler()]
-        h.extend(nested_handlers(handlers))
+        h.extend(handlers)
         self.events = Events(*h)
         self.loop = SelectLoop(self.events)
         self.trigger = None


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org