ladon-dev-team team mailing list archive
-
ladon-dev-team team
-
Mailing list archive
-
Message #00070
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:
https://answers.launchpad.net/ladon/+question/187448
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):
pass
setattr( MyType, 'selfreferlist', {
'type' : [MyType],
'doc' : 'Just a property having reference to the list of the same type
objects'
})
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,
Mike