-
Notifications
You must be signed in to change notification settings - Fork 406
Make license attribute in response optional #804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make license attribute in response optional #804
Conversation
I had to manually manipulate this recording to remove the license key, so I need to find a way to avoid needing to do this as otherwise this can't be recreated and is just too kludgey, but hopefully it's a start and once I've ironed out how to test this case better, I can apply it for the other cases I come across as needed. |
6c26894
to
ec47b71
Compare
There's a lint error here.
The files in |
ec47b71
to
6b43242
Compare
@sigmavirus24 guess I should have mentioned after the last comment I worked out how to test this via the unit tests and force pushed an update, still just learning where everything is, sorry. |
Github Enterprise instances <= 2.12.7 do not include the license attribute in responses for repository data. Allow this to be not set and include a note in the documentation that the corresponding attr may be set to None. Partially fixes sigmavirus24#794
6b43242
to
08b1488
Compare
@@ -2447,7 +2455,7 @@ def _update_attributes(self, repo): | |||
self.has_wiki = repo['has_wiki'] | |||
self.homepage = repo['homepage'] | |||
self.language = repo['language'] | |||
self.original_license = repo['license'] | |||
self.original_license = repo.get('license', None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
repo.get()
returns None
implicitly. Can you share why you specified None
explicitly here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
purely to match the code style at
github3.py/github3/repos/repo.py
Lines 2458 to 2460 in aa50e04
self.parent = repo.get('parent', None) | |
if self.parent is not None: | |
self.parent = ShortRepository(self.parent, self) |
github3.py/github3/repos/repo.py
Lines 2463 to 2465 in aa50e04
self.source = repo.get('source', None) | |
if self.source is not None: | |
self.source = ShortRepository(self.source, self) |
Have no attachment to doing it that way, should I update all 3 calls to use the same approach? Or just this new occurrence?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might as well update all of them. I don't know what I was thinking. 😆
In retrospect I'm not that fussed either way about |
Github Enterprise instances <= 2.12.7 do not include the license
attribute in responses for repository data. Allow this to be not set
and include a note in the documentation that the corresponding attr may
be set to None.
Partially fixes #794