123456789101112131415161718192021222324252627282930 |
- # -*- coding: utf-8 -*-
- from __future__ import unicode_literals
- from django.conf.urls import url
- from django.conf import settings
- from tastypie.resources import Resource
- from tastypie.utils import trailing_slash
- from api.utils.jwt_authentication import JWTAuthentication
- from api.utils.git_api import get_odoo_modules_repos_names
- class GitResource(Resource):
- class Meta:
- resource_name = 'git'
- authentication = JWTAuthentication()
- '''
- '''
- def prepend_urls(self):
- return [
- url(r'^%s/repositories%s$' % (self._meta.resource_name, trailing_slash), self.wrap_view('get_repositories'), name="get_repositories"),
- ]
- '''
- '''
- def get_repositories(self, request, **kwargs):
- self.method_check(request, allowed='get')
- self.is_authenticated(request)
- return self.create_response(request, {
- 'repositories': get_odoo_modules_repos_names()
- })
|