support default empty AMQP tables

This commit is contained in:
Matthias Radestock 2008-08-26 20:29:02 +01:00
parent 7d62d02e18
commit 793bb869d2
1 changed files with 10 additions and 1 deletions

View File

@ -45,11 +45,20 @@ erlangTypeMap = {
'timestamp': 'timestamp',
}
# Coming up with a proper encoding of AMQP tables in JSON is too much
# hassle at this stage. Given that the only default value we are
# interested in is for the empty table, we only support that.
def convertTable(d):
if len(d) == 0:
return "[]"
else: raise 'Non-empty table defaults not supported', d
erlangDefaultValueTypeConvMap = {
bool : lambda x: str(x).lower(),
str : lambda x: "<<\"" + x + "\">>",
int : lambda x: str(x),
float : lambda x: str(x)
float : lambda x: str(x),
dict: convertTable
}
def erlangize(s):