1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
from django.conf import settings
from django.views import static
from .models import DocumentRelease
from .utils import get_doc_root_or_404
def sphinx_static(request, lang, version, path, subpath):
"""
Serve Sphinx static assets from a subdir of the build location.
"""
document_root = get_doc_root_or_404(lang, version) / subpath
return static.serve(request, document_root=document_root, path=path)
def objects_inventory(request, lang, version):
response = static.serve(
request,
document_root=get_doc_root_or_404(lang, version),
path="objects.inv",
)
response["Content-Type"] = "text/plain"
return response
def pot_file(request, pot_name):
version = DocumentRelease.objects.current().version
doc_root = get_doc_root_or_404(
settings.DEFAULT_LANGUAGE_CODE, version, builder="gettext"
)
return static.serve(request, document_root=doc_root, path=pot_name)
|