NO-JIRA: Add lazy handlers property to python Handler

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

Branch: refs/heads/proton-go
Commit: 3bae2f0cb637726d48518386022fa80c505cf41b
Parents: 69fa53b
Author: Bozo Dragojevic <[email protected]>
Authored: Mon Sep 28 10:53:15 2015 +0200
Committer: Bozo Dragojevic <[email protected]>
Committed: Mon Sep 28 12:42:33 2015 +0200

----------------------------------------------------------------------
 proton-c/bindings/python/proton/__init__.py | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3bae2f0c/proton-c/bindings/python/proton/__init__.py
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/proton/__init__.py 
b/proton-c/bindings/python/proton/__init__.py
index dcc2be7..a315f62 100644
--- a/proton-c/bindings/python/proton/__init__.py
+++ b/proton-c/bindings/python/proton/__init__.py
@@ -3850,7 +3850,16 @@ class Event(Wrapper, EventBase):
   def __repr__(self):
     return "%s(%s)" % (self.type, self.context)
 
+class LazyHandlers(object):
+  def __get__(self, obj, clazz):
+    if obj is None:
+      return self
+    ret = []
+    obj.__dict__['handlers'] = ret
+    return ret
+
 class Handler(object):
+  handlers = LazyHandlers()
 
   def on_unhandled(self, method, *args):
     pass


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to