Skip to content

Commit ce0b114

Browse files
authored
Merge pull request #4038 from stsewd/remove-dead-code-apiv1
Remove dead code from api v1
2 parents 30eabd1 + 57e2f33 commit ce0b114

File tree

1 file changed

+1
-35
lines changed

1 file changed

+1
-35
lines changed

readthedocs/api/base.py

+1-35
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from __future__ import (
44
absolute_import, division, print_function, unicode_literals)
55

6-
import json
76
import logging
87
from builtins import object
98

@@ -15,7 +14,7 @@
1514
from tastypie import fields
1615
from tastypie.authorization import DjangoAuthorization
1716
from tastypie.constants import ALL, ALL_WITH_RELATIONS
18-
from tastypie.http import HttpApplicationError, HttpCreated
17+
from tastypie.http import HttpCreated
1918
from tastypie.resources import ModelResource
2019
from tastypie.utils import dict_strip_unicode_keys, trailing_slash
2120

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

81-
def sync_versions(self, request, **kwargs):
82-
"""
83-
Sync the version data in the repo (on the build server) with what we have in the database.
84-
85-
Returns the identifiers for the versions that have been deleted.
86-
"""
87-
project = get_object_or_404(Project, pk=kwargs['pk'])
88-
try:
89-
post_data = self.deserialize(
90-
request,
91-
request.body,
92-
format=request.META.get('CONTENT_TYPE', 'application/json'),
93-
)
94-
data = json.loads(post_data)
95-
self.method_check(request, allowed=['post'])
96-
self.is_authenticated(request)
97-
self.throttle_check(request)
98-
self.log_throttled_access(request)
99-
self._sync_versions(project, data['tags'])
100-
self._sync_versions(project, data['branches'])
101-
deleted_versions = self._delete_versions(project, data)
102-
except Exception as e:
103-
return self.create_response(
104-
request,
105-
{'exception': str(e)},
106-
response_class=HttpApplicationError,
107-
)
108-
return self.create_response(request, deleted_versions)
109-
11080
def prepend_urls(self):
11181
return [
11282
url(
@@ -116,10 +86,6 @@ def prepend_urls(self):
11686
r'^(?P<resource_name>%s)/search%s$' %
11787
(self._meta.resource_name, trailing_slash()),
11888
self.wrap_view('get_search'), name='api_get_search'),
119-
url(
120-
r'^(?P<resource_name>%s)/(?P<pk>\d+)/sync_versions%s$' %
121-
(self._meta.resource_name, trailing_slash()),
122-
self.wrap_view('sync_versions'), name='api_sync_versions'),
12389
url((r'^(?P<resource_name>%s)/(?P<slug>[a-z-_]+)/$') %
12490
self._meta.resource_name, self.wrap_view('dispatch_detail'),
12591
name='api_dispatch_detail'),

0 commit comments

Comments
 (0)