X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/357027375ff8867f42ca34bcbfb5a78b5b185fc3..1959361810afbb5f1de88b7d717da32979c7235d:/src/waiter/views.py?ds=sidebyside diff --git a/src/waiter/views.py b/src/waiter/views.py index b951cc4c8..de9dfea1f 100644 --- a/src/waiter/views.py +++ b/src/waiter/views.py @@ -1,6 +1,5 @@ -# -*- coding: utf-8 -*- -# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# This file is part of Wolne Lektury, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Wolne Lektury. See NOTICE for more information. # from os.path import join from waiter.models import WaitedFile @@ -8,17 +7,22 @@ from waiter.settings import WAITER_URL from django.shortcuts import render, get_object_or_404 from django.http import HttpResponse from django.views.decorators.cache import never_cache +from wolnelektury.utils import is_ajax @never_cache def wait(request, path): if WaitedFile.exists(path): file_url = join(WAITER_URL, path) + waiting = None else: - file_url = "" + file_url = None waiting = get_object_or_404(WaitedFile, path=path) - if request.is_ajax(): + if is_ajax(request): return HttpResponse(file_url) else: - return render(request, "waiter/wait.html", locals()) + return render(request, "waiter/wait.html", { + 'waiting': waiting, + 'file_url': file_url, + })