Skip to content

Conversation

akda5id
Copy link

@akda5id akda5id commented Apr 3, 2024

If so, make it None.

See for discussion #143

and Master, if so, make it None
super(Release, self).__init__(client, dict_)
self.data['resource_url'] = '{0}/releases/{1}'.format(client._base_url, dict_['id'])
if not 'year' in dict_:
dict_['year'] = None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, sorry for the delay in responding, I'm travelling and try to stay offline as much as I can ;-) Also excuse any sloppy formatting, I try to do my best while editing on mobile...

Anyway, interesting, and yes it's a quickfix but I'm wondering how we could make it a fix for potentially all fields that could be missing.

I'm probably just thinking out loud and havent thought all this through thoroughly enough, but:

We are defining year as a SimpleField here:

year = SimpleField() #:

Why wouldnt it be possible to fall back to None here already?

class SimpleField(Field):

descriptor class:

def __get__(self, instance, owner):

the ObjectDescriptor class does have some kind of fallback to None, we could try to do something similar in the SimpleDescriptor:

if self.optional and not response_dict:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesnt year default to 0 if no year is specified so there should always be a value

@JOJ0 JOJ0 marked this pull request as draft May 21, 2025 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants