You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rh...@apache.org on 2012/10/16 18:03:48 UTC
svn commit: r1398866 - /qpid/proton/trunk/proton-c/bindings/python/proton.py
Author: rhs
Date: Tue Oct 16 16:03:47 2012
New Revision: 1398866
URL: http://svn.apache.org/viewvc?rev=1398866&view=rev
Log:
added default mapping for unmapped types
Modified:
qpid/proton/trunk/proton-c/bindings/python/proton.py
Modified: qpid/proton/trunk/proton-c/bindings/python/proton.py
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/bindings/python/proton.py?rev=1398866&r1=1398865&r2=1398866&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/bindings/python/proton.py (original)
+++ qpid/proton/trunk/proton-c/bindings/python/proton.py Tue Oct 16 16:03:47 2012
@@ -658,6 +658,14 @@ class DataException(ProtonException):
"""
pass
+class UnmappedType:
+
+ def __init__(self, msg):
+ self.msg = msg
+
+ def __repr__(self):
+ return "UnmappedType(%s)" % self.msg
+
class Data:
"""
The L{Data} class provides an interface for decoding, extracting,
@@ -1411,8 +1419,11 @@ class Data:
def get_object(self):
type = self.type()
if type is None: return None
- getter = self.get_mappings[type]
- return getter(self)
+ getter = self.get_mappings.get(type)
+ if getter:
+ return getter(self)
+ else:
+ return UnmappedType(str(type))
class ConnectionException(ProtonException):
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org