Adding hack to createVOEvent for file text

Adding same hack as in voevents() to return the VOEvent file text.
This is temporary and will be removed in a future release.
parent a669a741
......@@ -1619,7 +1619,7 @@ class GraceDb(GsiRest):
skymap_filename=None, skymap_image_filename=None, internal=True,
vetted=False, open_alert=False, hardware_inj=False,
CoincComment=False, ProbHasNS=None, ProbHasRemnant=None,
*args, **kwargs):
get_voevent_file_text=True, *args, **kwargs):
# TBD for superevents - requires a lot of changes to server code
"""Create a new VOEvent
......@@ -1696,7 +1696,30 @@ class GraceDb(GsiRest):
if ProbHasRemnant:
body['ProbHasRemnant'] = ProbHasRemnant
return, body=body)
response =, body=body)
# Temporary hack to get voevent file text and include it in a
# response-like object for user consumption. Will be removed in a
# future release.
if get_voevent_file_text:
# print a deprecation warning
print("WARNING: the VOEvent file text will not be included in the "
"response JSON in a future release. Users can still get the "
"content of this file by using the files() method along with "
"the filename which is included in the response JSON. You may "
"call this method with the keyword argument "
"get_voevent_file_text=False if you do not need the file "
"content and would like to remove this warning message.")
# Get actual response JSON
r_json = response.json()
# Get file and add text
file_text = self.files(object_id, r_json['filename']).read()
r_json[u'text'] = file_text.decode()
response = FakeResponse(r_json)
return response
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment