Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ def split_piped_params(params_string) -> List[str]:
return params

def _handle_warnings(self, data):
if len(data['available_versions']) == 0 and not self.oref.index_node.is_virtual:
return jsonResponse({'error': f'We have no text for {self.oref}.'}, status=404)
data['warnings'] = []
for lang, vtitle in data['missings']:
if lang == 'source':
Expand All @@ -43,9 +45,6 @@ def _handle_warnings(self, data):
return data

def get(self, request, *args, **kwargs):
if self.oref.is_empty() and not self.oref.index_node.is_virtual:
return jsonResponse({'error': f'We have no text for {self.oref}.'}, status=404)

versions_params = request.GET.getlist('version', [])
if not versions_params:
versions_params = ['primary']
Expand Down
2 changes: 1 addition & 1 deletion sefaria/model/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -3746,7 +3746,7 @@ def is_empty(self, lang=None):
"""
Checks if :class:`Ref` has any corresponding data in :class:`Version` records.

:return: Bool True is there is not text at this ref in any language
:return: Bool True is there is no text at this ref in any language
"""

# The commented code is easier to understand, but the code we're using puts a lot less on the wire.
Expand Down
Loading