Skip to content

Commit f4ca9ec

Browse files
abhizipstackclaude
andcommitted
fix: move @clear_cache below @handle_permission to avoid cache invalidation on 403
Decorator order is now: @api_view → @handle_http_request → @handle_permission → @clear_cache Cache is only cleared when the request passes permission checks. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 31928cf commit f4ca9ec

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

  • backend/backend/core/routers/transformation

backend/backend/core/routers/transformation/views.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ def save_model_file(request: Request, project_id: str, file_name: str) -> Respon
3535

3636

3737
@api_view([HTTPMethods.POST])
38-
@clear_cache(patterns=["model_content_{project_id}_*"])
3938
@handle_http_request
4039
@handle_permission
40+
@clear_cache(patterns=["model_content_{project_id}_*"])
4141
def set_model_config_and_reference(
4242
request: Request, project_id: str, file_name: str
4343
) -> Response:
@@ -102,9 +102,9 @@ def set_model_config_and_reference(
102102

103103

104104
@api_view([HTTPMethods.POST])
105-
@clear_cache(patterns=["model_content_{project_id}_*"])
106105
@handle_http_request
107106
@handle_permission
107+
@clear_cache(patterns=["model_content_{project_id}_*"])
108108
def set_model_transformation(
109109
request: Request, project_id: str, file_name: str
110110
) -> Response:
@@ -120,9 +120,9 @@ def set_model_transformation(
120120

121121

122122
@api_view([HTTPMethods.DELETE])
123-
@clear_cache(patterns=["model_content_{project_id}_*"])
124123
@handle_http_request
125124
@handle_permission
125+
@clear_cache(patterns=["model_content_{project_id}_*"])
126126
def delete_model_transformation(
127127
request: Request, project_id: str, file_name: str
128128
) -> Response:
@@ -142,9 +142,9 @@ def delete_model_transformation(
142142

143143

144144
@api_view([HTTPMethods.POST])
145-
@clear_cache(patterns=["model_content_{project_id}_*"])
146145
@handle_http_request
147146
@handle_permission
147+
@clear_cache(patterns=["model_content_{project_id}_*"])
148148
def set_model_presentation(
149149
request: Request, project_id: str, file_name: str
150150
) -> Response:

0 commit comments

Comments
 (0)