Skip to content

Commit bf15497

Browse files
committed
add @never_cache to all GET views in api that didnot have them
1 parent 588cd6e commit bf15497

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

api/views.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ def post(self, request: Request, table: str) -> JsonLikeResponse:
200200
metadata, error = try_validate_metadata(metadata)
201201

202202
if metadata is not None:
203-
204203
# update/sync keywords with tags before saving metadata
205204
# TODO make this iter over all resources
206205
keywords = metadata["resources"][0].get("keywords", []) or []
@@ -371,7 +370,6 @@ def put(self, request: Request, table: str) -> JsonLikeResponse:
371370

372371
metadata = payload_query.get("metadata")
373372
if metadata:
374-
375373
set_table_metadata(table=table, metadata=metadata)
376374

377375
return JsonResponse({}, status=status.HTTP_201_CREATED)
@@ -397,7 +395,7 @@ def get(
397395
try:
398396
response = response[column]
399397
except KeyError:
400-
raise APIError("The column specified is not part of " "this table.")
398+
raise APIError("The column specified is not part of this table.")
401399
return JsonResponse(response)
402400

403401
@api_exception
@@ -795,7 +793,7 @@ def __insert_row(
795793
):
796794
if row_id and row.get("id", int(row_id)) != int(row_id):
797795
return response_error(
798-
"The id given in the query does not " "match the id given in the url"
796+
"The id given in the query does not match the id given in the url"
799797
)
800798
if row_id:
801799
row["id"] = row_id
@@ -904,6 +902,7 @@ def __get_rows(self, request: Request, table_obj: Table, data):
904902

905903

906904
@api_exception
905+
@never_cache
907906
def table_approx_row_count_view(request: HttpRequest, table: str) -> JsonResponse:
908907
table_obj = table_or_404(table=table)
909908
precise_below = int(
@@ -917,6 +916,7 @@ def table_approx_row_count_view(request: HttpRequest, table: str) -> JsonRespons
917916

918917

919918
@api_exception
919+
@never_cache
920920
def usrprop_api_view(request: Request) -> JsonLikeResponse:
921921
query = request.GET.get("name", "")
922922

@@ -941,6 +941,7 @@ def usrprop_api_view(request: Request) -> JsonLikeResponse:
941941
return JsonResponse(user_names, safe=False)
942942

943943

944+
@never_cache
944945
@api_exception
945946
def grpprop_api_view(request: Request) -> JsonLikeResponse:
946947
"""
@@ -976,6 +977,7 @@ def grpprop_api_view(request: Request) -> JsonLikeResponse:
976977
return JsonResponse(group_names, safe=False)
977978

978979

980+
@never_cache
979981
@api_exception
980982
def oeo_search_api_view(request: Request) -> JsonLikeResponse:
981983
if USE_LOEP:
@@ -994,6 +996,7 @@ def oeo_search_api_view(request: Request) -> JsonLikeResponse:
994996
return JsonResponse(res, safe=False)
995997

996998

999+
@never_cache
9971000
@api_exception
9981001
def oevkg_query_api_view(request: Request) -> JsonLikeResponse:
9991002
if USE_ONTOP and ONTOP_SPARQL_ENDPOINT_URL:
@@ -1121,6 +1124,7 @@ class AllTableSizesAPIView(APIView):
11211124
"""
11221125

11231126
@api_exception
1127+
@method_decorator(never_cache)
11241128
def get(self, request: Request) -> JsonLikeResponse:
11251129
table = request.query_params.get("table")
11261130

0 commit comments

Comments
 (0)