def content(request): result = None if request.is_ajax(): path = request.GET.get(u'path', '/') repo = Repository() result = repo.get_file_content(path) return HttpResponse(result, 'text/plain')
def unlock(request): result = False if request.is_ajax(): path = request.GET.get(u'path', None) repo = Repository() result = repo.unlock(path, request.user.username) return HttpResponse(json.dumps( { 'success': result } ), 'application/json')
def update(request): result = False if request.is_ajax(): path = request.GET.get(u'path', None) repo = Repository() result = repo.update(path, request.user.username) return HttpResponse(json.dumps( result ), 'application/json')
def search_files(request): result = None if request.is_ajax: path = request.GET.get(u'path', None) query = request.GET.get(u'query', None) repo = Repository() result = repo.search_files(path, query) return HttpResponse(json.dumps(result), 'application/json')
def list_files(request): result = None if request.is_ajax(): path = request.GET.get(u'path', '/') repo = Repository() tree = repo.tree(path) result = json.dumps(tree) return HttpResponse(result, 'application/json')
def commit_info(request): result = None if request.is_ajax(): rev = request.GET.get(u'rev', None) repo = Repository() commit = repo.get_commit(rev) result = json.dumps(commit) return HttpResponse(result, 'application/json')
def save(request): result = False if request.is_ajax(): path = request.POST.get(u'path', None) summary = request.POST.get(u'summary', None) data = request.POST.get(u'data', None) repo = Repository() result = repo.save(path, data, request.user.username, request.user.email, summary) return HttpResponse(json.dumps({ 'success': result }), 'application/json')
def create(request): result = False if request.is_ajax(): path = request.POST.get(u'path', None) is_dir = request.POST.get(u'is_dir', False) if is_dir == u'true': is_dir = True else: is_dir = False repo = Repository() result = repo.create(path, is_dir, request.user.username, request.user.email) return HttpResponse(json.dumps({ 'success': result }), 'application/json')