Skip to content

Commit

Permalink
simplify async
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneswilm committed Jan 23, 2025
1 parent 9acdafb commit b964682
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions fiduswriter/gitrepo_export/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
require_POST,
require_http_methods,
)
from asgiref.sync import async_to_sync, sync_to_async
from django.http import JsonResponse, HttpResponseForbidden, HttpResponse
from httpx import HTTPError
from base.decorators import ajax_required
Expand Down Expand Up @@ -85,10 +84,8 @@ def update_book_repo(request):
return HttpResponse(status=status)


@sync_to_async
@login_required
@require_GET
@async_to_sync
async def get_git_repos(request, reload=False):
social_tokens = {
"github": await SocialToken.objects.filter(
Expand Down Expand Up @@ -133,10 +130,8 @@ async def get_git_repos(request, reload=False):
return JsonResponse({"repos": repos}, status=200)


@sync_to_async
@login_required
@require_http_methods(["GET", "POST", "PATCH"])
@async_to_sync
async def proxy_github(request, path):
try:
response = await github.proxy(
Expand All @@ -159,10 +154,8 @@ async def proxy_github(request, path):
return HttpResponse(response.text, status=response.status_code)


@sync_to_async
@login_required
@require_http_methods(["GET", "POST", "PATCH"])
@async_to_sync
async def proxy_gitlab(request, path):
try:
response = await gitlab.proxy(
Expand All @@ -186,10 +179,8 @@ async def proxy_gitlab(request, path):
return HttpResponse(response.text, status=response.status_code)


@sync_to_async
@login_required
@require_GET
@async_to_sync
async def get_gitlab_repo(request, id):
try:
files = await gitlab.get_repo(request, id, request.user)
Expand Down

0 comments on commit b964682

Please sign in to comment.