From 793bb869d223dbdabd3d69ca9094ace9521fdcae Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Tue, 26 Aug 2008 20:29:02 +0100 Subject: support default empty AMQP tables --- codegen.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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): -- cgit v1.2.1