-
Notifications
You must be signed in to change notification settings - Fork 16
Description
I've run into a problem where I'm trying to assign an Entry returned from environment.entries().find() to a reference field in another Entry.
The problem is it seems if I have type as a field name in Contentful, it's running into issues when it eventually calls to_link() here: https://github.com/contentful/contentful-management.py/blob/master/contentful_management/resource.py#L153
I think because the __getattr__ is returning the regular field type as a higher priority to the sys field type. So the link_type is getting assigned whatever the regular field type was set to, which doesn't make sense in the context of Links. One solution is of course to just never use a field called type in our schema, but perhaps we could change the line to:
link_type = self.link_type if self.sys['type'] == 'Link' else self.sys['type']
That way it won't rely on __getattr__ and will be guaranteed to get the proper sys type. What do you think? I can create a PR if necessary.