summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Anthony Giusti <kgiusti@apache.org>2010-07-14 19:57:48 +0000
committerKenneth Anthony Giusti <kgiusti@apache.org>2010-07-14 19:57:48 +0000
commit9f049123873c4595c63cdc926f982e0e6443a366 (patch)
tree3f4eb64447f14c8a2ae14b43b2b37bc7011dd10f
parenta3b5ba5a04c7227dc53043f18665904ea8af6d3c (diff)
downloadqpid-python-9f049123873c4595c63cdc926f982e0e6443a366.tar.gz
QMF: fix for r961919 - accept old style class keys without throwing an exception.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@964155 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--extras/qmf/src/py/qmf/console.py30
1 files changed, 18 insertions, 12 deletions
diff --git a/extras/qmf/src/py/qmf/console.py b/extras/qmf/src/py/qmf/console.py
index 77de1602f2..d198560224 100644
--- a/extras/qmf/src/py/qmf/console.py
+++ b/extras/qmf/src/py/qmf/console.py
@@ -1504,13 +1504,17 @@ class SchemaCache(object):
new_package = True
packageMap = self.packages[pname]
if pkey not in packageMap:
- new_class = True
- # hack: if no classDef given, store the class type code until we get
- # the full schema:
- if classDef is None:
- packageMap[pkey] = classKey.getType()
- else:
- packageMap[pkey] = classDef
+ if classDef is not None:
+ new_class = True
+ packageMap[pkey] = classDef
+ elif classKey.getType() is not None:
+ # hack: don't indicate "new_class" to caller unless the classKey type
+ # information is present. "new_class" causes the console.newClass()
+ # callback to be invoked, which -requires- a valid classKey type!
+ new_class = True
+ # store the type for the getClasses() method:
+ packageMap[pkey] = classKey.getType()
+
finally:
self.lock.release()
return (new_package, new_class)
@@ -1557,9 +1561,9 @@ class ClassKey:
self.pname = constructor['_package_name']
self.cname = constructor['_class_name']
self.hash = constructor['_hash']
- self.type = constructor['_type']
+ self.type = constructor.get('_type')
except:
- raise Exception("Invalid ClassKey map format")
+ raise Exception("Invalid ClassKey map format %s" % str(constructor))
else:
# construct from codec
codec = constructor
@@ -1576,10 +1580,12 @@ class ClassKey:
codec.write_bin128(self.hash.bytes)
def asMap(self):
- return {'_package_name': self.pname,
+ m = {'_package_name': self.pname,
'_class_name': self.cname,
- '_hash': self.hash,
- '_type': self.type}
+ '_hash': self.hash}
+ if self.type is not None:
+ m['_type'] = self.type
+ return m
def getPackageName(self):
return self.pname