mirror of
https://github.com/boostorg/website-v2.git
synced 2026-01-19 04:42:17 +00:00
Add comments, cleanup
This commit is contained in:
@@ -104,7 +104,7 @@ def get_content_from_s3(key=None, bucket_name=None):
|
||||
|
||||
def get_content_type(s3_key, content_type):
|
||||
"""In some cases, manually set the content-type for a given S3 key based on the
|
||||
file extension. This is useful for files types that are not reognized by S3, or for
|
||||
file extension. This is useful for files types that are not recognized by S3, or for
|
||||
cases where we want to override the default content-type.
|
||||
|
||||
:param s3_key: The S3 key for the file
|
||||
@@ -113,6 +113,9 @@ def get_content_type(s3_key, content_type):
|
||||
"""
|
||||
if s3_key.endswith(".js"):
|
||||
content_type = "application/javascript"
|
||||
# adoc files come back from S3 with a generic content type, so we manually set
|
||||
# the content type to the (proposed) asciidoc content type:
|
||||
# https://docs.asciidoctor.org/asciidoc/latest/faq/
|
||||
elif s3_key.endswith(".adoc"):
|
||||
content_type = "text/asciidoc"
|
||||
return content_type
|
||||
|
||||
@@ -2,9 +2,17 @@ from ..boostrenderer import get_content_type, get_s3_keys
|
||||
|
||||
|
||||
def test_get_content_type():
|
||||
# HTML file content type is text/html
|
||||
assert get_content_type("/marshmallow/index.html", "text/html"), "text/html"
|
||||
|
||||
# CSS file content type is text/css
|
||||
assert get_content_type("/rst.css", "text/css"), "text/css"
|
||||
|
||||
# Asciidoc content, which comes from S3 with an .adoc extension but not a useful
|
||||
# content type, should be changed to text/asciidoc
|
||||
assert get_content_type("/site/develop/help.adoc", "text/html"), "text/asciidoc"
|
||||
|
||||
# JS file content type is always set to application/javascript
|
||||
assert get_content_type(
|
||||
"/site/develop/doc/html/scripts.js", "text/html"
|
||||
), "application/javascript"
|
||||
|
||||
@@ -89,17 +89,9 @@ services:
|
||||
context: .
|
||||
dockerfile: docker/Dockerfile
|
||||
command:
|
||||
[
|
||||
"/bin/bash",
|
||||
"-c",
|
||||
"./wait-for-it.sh &&",
|
||||
"celery",
|
||||
"-A",
|
||||
"config",
|
||||
"worker",
|
||||
"--concurrency=10",
|
||||
"--loglevel=debug"
|
||||
]
|
||||
- /bin/bash
|
||||
- -c
|
||||
- ./wait-for-it.sh && celery -A config worker --concurrency=10 --loglevel=debug
|
||||
networks:
|
||||
- backend
|
||||
env_file:
|
||||
|
||||
Reference in New Issue
Block a user