Dictionary type-defintion does not support list
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ladon |
In Progress
|
Low
|
jsgaarde |
Bug Description
Hi,
I'm using Ladon 0.7 and as far as I am correct, the dictionary type-defintion does not support lists as type, ie:
class MyType(LadonType):
attrib = {'type': [PORTABLE_STRING]}
raises an exception (AttributeError: 'list' object has no attribute '__bases__') but
class MyType(LadonType):
attrib = [PORTABLE_STRING]
does not.
I had a look at the code and I suppose this is due to the fact that, in the method analyze_class of TypeManager in ladon/types/
As a very quick hack, on my local version, I added at the end of the condition (between line 112 and 114):
[line 112: attr_val = temp_attr_val *** Not Changed ***]
if type(attr_
[line 114: elif type(attr_
It seems to solve the problem but this is certainly not the more elegant solution for this.
This is not a bug, it has simply not been implemented yet, but it is in my to-do list.
Best regards
Jakob Simon-Gaarde