Skip to content

Fix lint errors for oauth app #2869

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 1 commit into from
May 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion prospector-more.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ ignore-paths:
- donate/
- gold/
- notifications/
- oauth/
- payments/
- privacy/
- profiles/
Expand Down
8 changes: 8 additions & 0 deletions readthedocs/oauth/admin.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
"""Admin configuration for the OAuth app."""

from django.contrib import admin

from .models import RemoteRepository, RemoteOrganization


class RemoteRepositoryAdmin(admin.ModelAdmin):

"""Admin configuration for the RemoteRepository model."""

raw_id_fields = ('users',)


class RemoteOrganizationAdmin(admin.ModelAdmin):

"""Admin configuration for the RemoteOrganization model."""

raw_id_fields = ('users',)


Expand Down
4 changes: 2 additions & 2 deletions readthedocs/oauth/services/bitbucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def create_repository(self, fields, privacy=DEFAULT_PRIVACY_LEVEL,
account=self.account,
)
if repo.organization and repo.organization != organization:
log.debug('Not importing %s because mismatched orgs' %
log.debug('Not importing %s because mismatched orgs',
fields['name'])
return None
else:
Expand Down Expand Up @@ -139,7 +139,7 @@ def create_repository(self, fields, privacy=DEFAULT_PRIVACY_LEVEL,
repo.save()
return repo
else:
log.debug('Not importing %s because mismatched type' %
log.debug('Not importing %s because mismatched type',
fields['name'])

def create_organization(self, fields):
Expand Down
15 changes: 7 additions & 8 deletions readthedocs/oauth/services/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def create_repository(self, fields, privacy=DEFAULT_PRIVACY_LEVEL,
)
repo.users.add(self.user)
if repo.organization and repo.organization != organization:
log.debug('Not importing %s because mismatched orgs' %
log.debug('Not importing %s because mismatched orgs',
fields['name'])
return None
else:
Expand All @@ -116,7 +116,7 @@ def create_repository(self, fields, privacy=DEFAULT_PRIVACY_LEVEL,
repo.save()
return repo
else:
log.debug('Not importing %s because mismatched type' %
log.debug('Not importing %s because mismatched type',
fields['name'])

def create_organization(self, fields):
Expand Down Expand Up @@ -214,7 +214,6 @@ def setup_webhook(self, project):
except (RequestException, ValueError):
log.error('GitHub webhook creation failed for project: %s',
project, exc_info=True)
pass
else:
log.error('GitHub webhook creation failed for project: %s',
project)
Expand All @@ -224,7 +223,7 @@ def setup_webhook(self, project):
except ValueError:
debug_data = resp.content
log.debug('GitHub webhook creation failure response: %s',
resp.json())
debug_data)
return (False, resp)

def update_webhook(self, project, integration):
Expand Down Expand Up @@ -259,15 +258,15 @@ def update_webhook(self, project, integration):
except (RequestException, ValueError):
log.error('GitHub webhook update failed for project: %s',
project, exc_info=True)
pass
else:
log.error('GitHub webhook update failed for project: %s',
project)
try:
log.debug('GitHub webhook creation failure response: %s',
resp.json())
debug_data = resp.json()
except ValueError:
pass
debug_data = resp.content
log.debug('GitHub webhook creation failure response: %s',
debug_data)
return (False, resp)

@classmethod
Expand Down
3 changes: 2 additions & 1 deletion readthedocs/oauth/utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Support code for OAuth, including webhook support."""
import logging

from django.contrib import messages
Expand Down Expand Up @@ -36,7 +37,7 @@ def attach_webhook(project, request=None):

user_accounts = service.for_user(request.user)
for account in user_accounts:
success, resp = account.setup_webhook(project)
success, __ = account.setup_webhook(project)
if success:
messages.success(request, _('Webhook activated'))
project.has_valid_webhook = True
Expand Down