Handle missing endpoints
This commit is contained in:
parent
d28848412c
commit
bc3927759f
1 changed files with 12 additions and 4 deletions
|
|
@ -79,19 +79,25 @@ class CaptureSchema(ImageSchema):
|
||||||
"href": url_for(CaptureView.endpoint, id_=capture_id, _external=True),
|
"href": url_for(CaptureView.endpoint, id_=capture_id, _external=True),
|
||||||
"mimetype": "application/json",
|
"mimetype": "application/json",
|
||||||
**description_from_view(CaptureView),
|
**description_from_view(CaptureView),
|
||||||
},
|
}
|
||||||
|
if CaptureView.endpoint
|
||||||
|
else {},
|
||||||
"tags": {
|
"tags": {
|
||||||
"href": url_for(CaptureTags.endpoint, id_=capture_id, _external=True),
|
"href": url_for(CaptureTags.endpoint, id_=capture_id, _external=True),
|
||||||
"mimetype": "application/json",
|
"mimetype": "application/json",
|
||||||
**description_from_view(CaptureTags),
|
**description_from_view(CaptureTags),
|
||||||
},
|
}
|
||||||
|
if CaptureTags.endpoint
|
||||||
|
else {},
|
||||||
"annotations": {
|
"annotations": {
|
||||||
"href": url_for(
|
"href": url_for(
|
||||||
CaptureAnnotations.endpoint, id_=capture_id, _external=True
|
CaptureAnnotations.endpoint, id_=capture_id, _external=True
|
||||||
),
|
),
|
||||||
"mimetype": "application/json",
|
"mimetype": "application/json",
|
||||||
**description_from_view(CaptureAnnotations),
|
**description_from_view(CaptureAnnotations),
|
||||||
},
|
}
|
||||||
|
if CaptureAnnotations.endpoint
|
||||||
|
else {},
|
||||||
"download": {
|
"download": {
|
||||||
"href": url_for(
|
"href": url_for(
|
||||||
CaptureDownload.endpoint,
|
CaptureDownload.endpoint,
|
||||||
|
|
@ -101,7 +107,9 @@ class CaptureSchema(ImageSchema):
|
||||||
),
|
),
|
||||||
"mimetype": "image/jpeg",
|
"mimetype": "image/jpeg",
|
||||||
**description_from_view(CaptureDownload),
|
**description_from_view(CaptureDownload),
|
||||||
},
|
}
|
||||||
|
if CaptureDownload.endpoint
|
||||||
|
else {},
|
||||||
}
|
}
|
||||||
|
|
||||||
if isinstance(data, dict):
|
if isinstance(data, dict):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue