You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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#L153I think because the
__getattr__
is returning the regular fieldtype
as a higher priority to the sys fieldtype
. So thelink_type
is getting assigned whatever the regular fieldtype
was set to, which doesn't make sense in the context of Links. One solution is of course to just never use a field calledtype
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.The text was updated successfully, but these errors were encountered: