Generated: Sun 2014-03-16 19:26 GMT
Source file: /var/www/service.dev/service/ftp_deploy/server/views/api.py
Stats: 11 executed, 0 missed, 9 excluded, 11 ignored
import jsonfrom django.views.generic.base import Viewfrom django.views.generic.detail import SingleObjectMixinfrom django.http import HttpResponsefrom braces.views import JSONResponseMixin, LoginRequiredMixinfrom ftp_deploy.conf import *from ftp_deploy.models import Servicefrom ftp_deploy.utils.curl import curl_connectionfrom ftp_deploy.utils.repo import repository_apiclass RepoAPIView(LoginRequiredMixin, JSONResponseMixin, SingleObjectMixin, View): """View for managing BitBucket API""" model = Service def dispatch(self, request, repo, *args, **kwargs): self.repo_api = repository_api(repo) return super(RepoAPIView, self).dispatch(request, repo, * args, **kwargs) def post(self, request, repo, *args, **kwargs): if self.request.POST['data'] == 'respositories': context = self.repo_api.repositories() elif self.request.POST['data'] == 'addhook': context = self.repo_api.add_hook(self.get_object(), request) return self.render_json_response(context)