support default empty AMQP tables
This commit is contained in:
parent
7d62d02e18
commit
793bb869d2
11
codegen.py
11
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):
|
||||
|
|
|
|||
Loading…
Reference in New Issue