Skip to content

Remove dead code from api v1 #4038

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
Apr 30, 2018
Merged
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
36 changes: 1 addition & 35 deletions readthedocs/api/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from __future__ import (
absolute_import, division, print_function, unicode_literals)

import json
import logging
from builtins import object

Expand All @@ -15,7 +14,7 @@
from tastypie import fields
from tastypie.authorization import DjangoAuthorization
from tastypie.constants import ALL, ALL_WITH_RELATIONS
from tastypie.http import HttpApplicationError, HttpCreated
from tastypie.http import HttpCreated
from tastypie.resources import ModelResource
from tastypie.utils import dict_strip_unicode_keys, trailing_slash

Expand Down Expand Up @@ -78,35 +77,6 @@ def post_list(self, request, **kwargs):
updated_bundle = self.obj_create(bundle, request=request)
return HttpCreated(location=self.get_resource_uri(updated_bundle))

def sync_versions(self, request, **kwargs):
"""
Sync the version data in the repo (on the build server) with what we have in the database.

Returns the identifiers for the versions that have been deleted.
"""
project = get_object_or_404(Project, pk=kwargs['pk'])
try:
post_data = self.deserialize(
request,
request.body,
format=request.META.get('CONTENT_TYPE', 'application/json'),
)
data = json.loads(post_data)
self.method_check(request, allowed=['post'])
self.is_authenticated(request)
self.throttle_check(request)
self.log_throttled_access(request)
self._sync_versions(project, data['tags'])
self._sync_versions(project, data['branches'])
deleted_versions = self._delete_versions(project, data)
except Exception as e:
return self.create_response(
request,
{'exception': str(e)},
response_class=HttpApplicationError,
)
return self.create_response(request, deleted_versions)

def prepend_urls(self):
return [
url(
Expand All @@ -116,10 +86,6 @@ def prepend_urls(self):
r'^(?P<resource_name>%s)/search%s$' %
(self._meta.resource_name, trailing_slash()),
self.wrap_view('get_search'), name='api_get_search'),
url(
r'^(?P<resource_name>%s)/(?P<pk>\d+)/sync_versions%s$' %
(self._meta.resource_name, trailing_slash()),
self.wrap_view('sync_versions'), name='api_sync_versions'),
url((r'^(?P<resource_name>%s)/(?P<slug>[a-z-_]+)/$') %
self._meta.resource_name, self.wrap_view('dispatch_detail'),
name='api_dispatch_detail'),
Expand Down