add ability to have reactor subclasses, and access these via the reactor property on events
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/92d69ccb Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/92d69ccb Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/92d69ccb Branch: refs/heads/master Commit: 92d69ccba474282f8ac0b0d410bf39c04afabed0 Parents: c500b81 Author: Gordon Sim <[email protected]> Authored: Wed Feb 11 22:21:43 2015 +0000 Committer: Gordon Sim <[email protected]> Committed: Thu Feb 12 13:48:52 2015 +0000 ---------------------------------------------------------------------- proton-c/bindings/python/proton/reactors.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/92d69ccb/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 dd29892..f4f32fc 100644 --- a/proton-c/bindings/python/proton/reactors.py +++ b/proton-c/bindings/python/proton/reactors.py @@ -880,7 +880,7 @@ class Container(object): import traceback from proton import WrappedHandler, _chandler, secs2millis, millis2secs, Selectable -from wrapper import Wrapper +from wrapper import Wrapper, PYCTX from cproton import * class Task(Wrapper): @@ -913,7 +913,12 @@ class Reactor(Wrapper): if impl is None: return None else: - return Reactor(impl=impl) + record = pn_reactor_attachments(impl) + attrs = pn_void2py(pn_record_get(record, PYCTX)) + if attrs and 'subclass' in attrs: + return attrs['subclass'](impl=impl) + else: + return Reactor(impl=impl) def __init__(self, *handlers, **kwargs): Wrapper.__init__(self, kwargs.get("impl", pn_reactor), pn_reactor_attachments) --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
