3
3
from __future__ import (
4
4
absolute_import , division , print_function , unicode_literals )
5
5
6
- import json
7
6
import logging
8
7
from builtins import object
9
8
15
14
from tastypie import fields
16
15
from tastypie .authorization import DjangoAuthorization
17
16
from tastypie .constants import ALL , ALL_WITH_RELATIONS
18
- from tastypie .http import HttpApplicationError , HttpCreated
17
+ from tastypie .http import HttpCreated
19
18
from tastypie .resources import ModelResource
20
19
from tastypie .utils import dict_strip_unicode_keys , trailing_slash
21
20
@@ -78,35 +77,6 @@ def post_list(self, request, **kwargs):
78
77
updated_bundle = self .obj_create (bundle , request = request )
79
78
return HttpCreated (location = self .get_resource_uri (updated_bundle ))
80
79
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
-
110
80
def prepend_urls (self ):
111
81
return [
112
82
url (
@@ -116,10 +86,6 @@ def prepend_urls(self):
116
86
r'^(?P<resource_name>%s)/search%s$' %
117
87
(self ._meta .resource_name , trailing_slash ()),
118
88
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' ),
123
89
url ((r'^(?P<resource_name>%s)/(?P<slug>[a-z-_]+)/$' ) %
124
90
self ._meta .resource_name , self .wrap_view ('dispatch_detail' ),
125
91
name = 'api_dispatch_detail' ),
0 commit comments