make linter happy
This commit is contained in:
parent
30b0c12ebe
commit
ef83e73a36
18 changed files with 31 additions and 26 deletions
|
@ -9,6 +9,7 @@ def api_etag_with_update_cache_key(permissions=True, etag_func=AccessPermission.
|
|||
|
||||
def inner_wrapper(func):
|
||||
func = api_etag(permissions=permissions, etag_func=etag_func, base_mapdata=base_mapdata)(func)
|
||||
|
||||
@wraps(func)
|
||||
def inner_wrapped_func(request, *args, **kwargs):
|
||||
try:
|
||||
|
@ -27,4 +28,4 @@ def api_etag_with_update_cache_key(permissions=True, etag_func=AccessPermission.
|
|||
return func(request, *args, **kwargs)
|
||||
|
||||
return inner_wrapped_func
|
||||
return inner_wrapper
|
||||
return inner_wrapper
|
||||
|
|
|
@ -116,7 +116,7 @@ def resolve_editor_path_api(request, path):
|
|||
response={200: dict, **API404.dict(), **auth_permission_responses},
|
||||
openapi_extra={"security": [{"APIKeyAuth": ["editor_access"]}]})
|
||||
@api_etag() # todo: correct?
|
||||
def view_as_api(request, path: str):
|
||||
def get_view_as_api(request, path: str):
|
||||
"""
|
||||
get editor views rendered as JSON instead of HTML.
|
||||
`path` is the path after /editor/.
|
||||
|
@ -138,7 +138,7 @@ def view_as_api(request, path: str):
|
|||
response={200: dict, **API404.dict(), **auth_permission_responses},
|
||||
openapi_extra={"security": [{"APIKeyAuth": ["editor_access", "write"]}]})
|
||||
@api_etag() # todo: correct?
|
||||
def view_as_api(request, path: str):
|
||||
def post_view_as_api(request, path: str):
|
||||
"""
|
||||
get editor views rendered as JSON instead of HTML.
|
||||
`path` is the path after /editor/.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from dataclasses import dataclass
|
||||
from itertools import chain
|
||||
from typing import Sequence
|
||||
from typing import TYPE_CHECKING, Sequence
|
||||
|
||||
from django.db.models import Prefetch, Q
|
||||
from shapely import prepared
|
||||
|
@ -55,6 +55,10 @@ def _get_geometries_for_one_level(level):
|
|||
return results
|
||||
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from c3nav.mapdata.models import Level
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
class LevelsForLevel:
|
||||
levels: Sequence[int] # IDs of all levels to render for this level, in order, including the level itself
|
||||
|
@ -270,7 +274,7 @@ def get_space_geometries_result(request, space_id: int, update_cache_key: str, u
|
|||
graph_edges = request.changeset.wrap_model('GraphEdge').objects.all()
|
||||
space_graphnodes_ids = tuple(node.pk for node in space_graph_nodes)
|
||||
graph_edges = graph_edges.filter(Q(from_node__pk__in=space_graphnodes_ids) |
|
||||
Q(to_node__pk__in=space_graphnodes_ids))
|
||||
Q(to_node__pk__in=space_graphnodes_ids))
|
||||
graph_edges = graph_edges.select_related('from_node', 'to_node', 'waytype').only(
|
||||
'from_node__geometry', 'to_node__geometry', 'waytype__color'
|
||||
)
|
||||
|
|
|
@ -270,9 +270,9 @@ def call_api_hybrid_view_for_api(func, request, *args, **kwargs):
|
|||
|
||||
# todo: fix this
|
||||
# api_response = APIResponse(result, status=response.status_code)
|
||||
if request.method == 'GET':
|
||||
response.add_headers(api_response)
|
||||
return api_response
|
||||
# if request.method == 'GET':
|
||||
# response.add_headers(api_response)
|
||||
# return api_response
|
||||
elif isinstance(response, HttpResponse) and response.status_code in (304, 412):
|
||||
# 304 Not Modified, 412 Precondition Failed
|
||||
return response
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue