← Back to team overview

ladon-dev-team team mailing list archive

Self-referencing complex types


Hi Jacob.

I'm trying to define complex type which has a property referencing to the
list of the same type. Currently Ladon does not work correctly in this case
procucing an error described in this ticket:

I've changed line #115 of ladon.types.typemanager.py to:

try :
is_ladontype = inspect.getmro(attr_val).count(LadonType)
except AttributeError:
is_ladontype = False
if is_ladontype:

And now everything seems work fine. Here is a sample how it can be used:

class MyType(LadonType):

setattr( MyType, 'selfreferlist', {
    'type' : [MyType],
    'doc' : 'Just a property having reference to the list of the same type

Now this exported correctly at service runtime.

BTW, I'm not sure what was done is a good fix. Jacob, could you please
comment this?

Best regards,