mirror of
https://github.com/encounter/decomp.me.git
synced 2026-03-30 11:06:27 -07:00
6b1ee90acd
* foyst * clang & agbcc * more * wii/gc * more * fix * more * references * fixes * CI fix * nabbed em * gcc2.7.2kmc * meowp * Tweak Dockerfile + other bits (#398) * Tweak Dockerfile + other bits * Capitalise * Enable/disable compiler downloads via Environment variables * appease black * migration * flags / presets in Compiler * fixed tests * /compilers * mypy cheese * upd8s * name * frontend goodness * i18n * cleaners Co-authored-by: Mark Street <22226349+mkst@users.noreply.github.com> Co-authored-by: Mark Street <streetster@gmail.com>
21 lines
648 B
Python
21 lines
648 B
Python
# This file wraps common django decorators in method_decorator for use with the APIView class
|
|
|
|
from datetime import datetime
|
|
|
|
from typing import Callable, Optional
|
|
|
|
from django.utils.decorators import method_decorator
|
|
from rest_framework.response import Response
|
|
|
|
|
|
def condition(
|
|
etag_func: Optional[Callable[..., Optional[str]]] = None,
|
|
last_modified_func: Optional[Callable[..., Optional[datetime]]] = None,
|
|
) -> Callable[..., Callable[..., Response]]:
|
|
"""
|
|
Handle Last-Modified and ETag headers.
|
|
"""
|
|
from django.views.decorators.http import condition
|
|
|
|
return method_decorator(condition(etag_func, last_modified_func))
|