X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/67ba56c7e72dcdc24fec08b77dfd7f62ed39aac0..8ac560f9402b05f2811bf8207338110f01e2e576:/apps/catalogue/views.py diff --git a/apps/catalogue/views.py b/apps/catalogue/views.py index b30297cd..e71b3495 100644 --- a/apps/catalogue/views.py +++ b/apps/catalogue/views.py @@ -204,18 +204,27 @@ def upload(request): }) -@never_cache -def book_xml(request, slug): - book = get_object_or_404(Book, slug=slug) +def serve_xml(request, book, slug): if not book.accessible(request): return HttpResponseForbidden("Not authorized.") xml = book.materialize() - response = http.HttpResponse(xml, content_type='application/xml') response['Content-Disposition'] = 'attachment; filename=%s.xml' % slug return response +@never_cache +def book_xml(request, slug): + book = get_object_or_404(Book, slug=slug) + return serve_xml(request, book, slug) + + +@never_cache +def book_xml_dc(request, slug): + book = get_object_or_404(Book, dc_slug=slug) + return serve_xml(request, book, slug) + + @never_cache def book_txt(request, slug): book = get_object_or_404(Book, slug=slug)