Skip to content

Instantly share code, notes, and snippets.

@grantmcconnaughey
Created January 5, 2017 01:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grantmcconnaughey/0456b67ab0e3b1ec5c180cd6e416222d to your computer and use it in GitHub Desktop.
Save grantmcconnaughey/0456b67ab0e3b1ec5c180cd6e416222d to your computer and use it in GitHub Desktop.
# This dict lives in its own file
git_clients = {
GITHUB: GitHubBackend,
DUMMY: DummyGitBackend
}
def get_projects(self, service):
# Dynamic based on the service
GitBackend = git_clients[service]
git_client = GitBackend(user=self)
repo_full_names = [r.full_name for r in git_client.get_user_repos()]
projects = Project.objects.filter(full_name__in=repo_full_names, service=service)
return projects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment