summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@lshift.net>2008-08-26 20:29:02 +0100
committerMatthias Radestock <matthias@lshift.net>2008-08-26 20:29:02 +0100
commit793bb869d223dbdabd3d69ca9094ace9521fdcae (patch)
treef7c2ca5e225e7ff4f8a61418a4c30f8e0beecb21
parent7d62d02e18f6ee9238515c486a3a5fb38def0252 (diff)
downloadrabbitmq-server-bug17070.tar.gz
support default empty AMQP tablesbug17070
-rw-r--r--codegen.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/codegen.py b/codegen.py
index 4785b18c..5dbc57c7 100644
--- a/codegen.py
+++ b/codegen.py
@@ -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):