8000 Implement Organization object refactor by omgjlk · Pull Request #747 · sigmavirus24/github3.py · GitHub
[go: up one dir, main page]

Skip to content

Implement Organization object refactor #747

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

Merged
merged 4 commits into from
Dec 18, 2017

Conversation

omgjlk
Copy link
Collaborator
@omgjlk omgjlk commented Dec 16, 2017

Splits Org into 3 objects, removes (most) of the None issues.

See commit messages for relevant info per-commit. Each commit should pass tests.

Related to #670

@omgjlk omgjlk force-pushed the split-org-object-670 branch 3 times, most recently from 120ddb5 to 3a33e62 Compare December 16, 2017 18:51
self.login = org['login']
self._api = self.url = org['url']

def to_org(self):
Copy link
Owner

Choose a reason for hiding this comment

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

👍

from .repos import Repository


class Team(GitHubCore):
class Team(models.GitHubCore):
Copy link
Owner

Choose a reason for hiding this comment

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

😍

github3/orgs.py Outdated
#: Various urls (not templates)
for urltype in ('avatar_url', 'events_url', 'issues_url',
'repos_url'):
self.__setattr__(urltype, org[urltype])
Copy link
Owner

Choose a reason for hiding this comment

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

Have I done something to make setattr(self, urltype, org[urltype]) unusable?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nope, I just forgot that particular syntax. I have no excuse 😄

8000

@sigmavirus24
Copy link
Owner

I have one question about the use of __setattr__ but otherwise, I'm a strong 👍 on this.

@omgjlk omgjlk force-pushed the split-org-object-670 branch from 3a33e62 to 73a93a8 Compare December 17, 2017 16:32
@omgjlk
Copy link
Collaborator Author
omgjlk commented Dec 17, 2017

I fixed up __setattr__ and re-pushed.

Clean them up as done in sigmavirus24#680 for users.py

Related-to: sigmavirus24#670

Signed-off-by: Jesse Keating <jkeating@j2solutions.net>
Alter how we import models as well, and fix a missing attribute on a
call.

Signed-off-by: Jesse Keating <jkeating@j2solutions.net>
This creates 3 new objects, one for iterations (Short), one for direct
GETs (Organization), and one for events (EventOrganization). Most
attributes can now be directly assigned, aside from a few that are only
returned in the API if they are set on the server. Default those to
None.

Many test cassettes needed to be updated to pick up attributes added to
orgs since the cassette was recorded (yay for additive REST APIs...).

Introduce a 'auto_login' method to handle either token auth or
username/password auth. Use it in the places I needed to update the
cassette.

Fix a few POST calls that were sending malformed (according to GitHub
API) json data. Specifically an empty permission is not accepted.

Related-to: sigmavirus24#670

Signed-off-by: Jesse Keating <jkeating@j2solutions.net>
@sigmavirus24
Copy link
Owner

Rebased this after I merged the Projects API support. Just want to make sure that the CI passes before merging. :)

@sigmavirus24 sigmavirus24 merged commit 8f21f79 into sigmavirus24:develop Dec 18, 2017
@sigmavirus24
Copy link
Owner

🎉 Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0