Skip to content
Snippets Groups Projects
Commit 09aeaedd authored by Alexander Pace's avatar Alexander Pace
Browse files

gracedb-2.28.2

parent bdb1c5eb
No related branches found
Tags gracedb-2.28.2
1 merge request!238gracedb-2.28.2
Pipeline #668933 passed
...@@ -48,7 +48,7 @@ INFO_BANNER_MESSAGE = "TEST MESSAGE" ...@@ -48,7 +48,7 @@ INFO_BANNER_MESSAGE = "TEST MESSAGE"
BETA_REPORTS_LINK = False BETA_REPORTS_LINK = False
# Version --------------------------------------------------------------------- # Version ---------------------------------------------------------------------
PROJECT_VERSION = '2.28.1' PROJECT_VERSION = '2.28.2'
# Unauthenticated access ------------------------------------------------------ # Unauthenticated access ------------------------------------------------------
# This variable should eventually control whether unauthenticated access is # This variable should eventually control whether unauthenticated access is
......
...@@ -73,6 +73,10 @@ use_in(ThoroughFlexibleContentHandler) ...@@ -73,6 +73,10 @@ use_in(ThoroughFlexibleContentHandler)
REST_FRAMEWORK_SETTINGS = getattr(settings, 'REST_FRAMEWORK', {}) REST_FRAMEWORK_SETTINGS = getattr(settings, 'REST_FRAMEWORK', {})
PAGINATE_BY = REST_FRAMEWORK_SETTINGS.get('PAGINATE_BY', 10) PAGINATE_BY = REST_FRAMEWORK_SETTINGS.get('PAGINATE_BY', 10)
# a "temporary" error message:
xml_err_msg = ('ligolw-xml rendering has been disabled, please use the '
'ligo-gracedb API to download event coinc xml data.')
# Custom APIView class for inheriting default permissions # Custom APIView class for inheriting default permissions
class InheritPermissionsAPIView(InheritDefaultPermissionsMixin, APIView): class InheritPermissionsAPIView(InheritDefaultPermissionsMixin, APIView):
pass pass
...@@ -374,6 +378,14 @@ class EventList(InheritPermissionsAPIView): ...@@ -374,6 +378,14 @@ class EventList(InheritPermissionsAPIView):
events = Event.objects.filter(graceid__isnull=False) events = Event.objects.filter(graceid__isnull=False)
# FIXME 20240923: ligolw rendering has been completely broken
# since the switch from glue. That hasn't stopped some random
# processes from requesting /api/events/ in the browser and throwing
# up errors. Return a 400 for now, and revisit fixing this later
# on (HA, sure).
if request.accepted_renderer.format == 'xml':
return HttpResponseBadRequest(xml_err_msg)
if query: if query:
# If the user is external, we must check to make sure that any query on FAR # If the user is external, we must check to make sure that any query on FAR
# value is within the safe range. # value is within the safe range.
...@@ -410,9 +422,10 @@ class EventList(InheritPermissionsAPIView): ...@@ -410,9 +422,10 @@ class EventList(InheritPermissionsAPIView):
numRows = events.count() numRows = events.count()
# Fail if the output format is ligolw, and there are more than 1000 events # Fail if the output format is ligolw, and there are more than 1000 events
if request.accepted_renderer.format == 'xml' and numRows > 1000: # FIXME when xml format is fixed
d = {'error': 'Too many events.' } #if request.accepted_renderer.format == 'xml' and numRows > 1000:
return Response(d, status=status.HTTP_400_BAD_REQUEST) # d = {'error': 'Too many events.' }
# return Response(d, status=status.HTTP_400_BAD_REQUEST)
last = max(0, (numRows // count)) * count last = max(0, (numRows // count)) * count
rv = {} rv = {}
...@@ -569,6 +582,14 @@ class EventDetail(InheritPermissionsAPIView): ...@@ -569,6 +582,14 @@ class EventDetail(InheritPermissionsAPIView):
response["Cache-Control"] = "no-cache" response["Cache-Control"] = "no-cache"
# FIXME 20240923: ligolw rendering has been completely broken
# since the switch from glue. That hasn't stopped some random
# processes from requesting /api/events/ in the browser and throwing
# up errors. Return a 400 for now, and revisit fixing this later
# on (HA, sure).
if request.accepted_renderer.format == 'xml':
return HttpResponseBadRequest(xml_err_msg)
# XXX Next, we try finalizing and rendering the response. According to # XXX Next, we try finalizing and rendering the response. According to
# the django rest framework docs (see .render() in # the django rest framework docs (see .render() in
# http://django-rest-framework.org/api-guide/responses.html), this is # http://django-rest-framework.org/api-guide/responses.html), this is
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment