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

Changes to translator.py for VOEvent updates

In testing, it was found that updating external events would result
in a 500 server error when GraceDB was assembling the update LVALert.
The new VOEventParse library was recording three VOEVent fields
as <StringElements> instead of strings, which was failing when the
event was being dumped to json.
parent e0e1fa03
No related branches found
No related tags found
No related merge requests found
......@@ -613,15 +613,15 @@ def populateGrbEventFromVOEventFile(filename, event):
# Assign information to event
event.gpstime = gpstime
event.ivorn = v.get('ivorn')
event.author_shortname = v.Who.Author.shortName
event.author_ivorn = v.Who.AuthorIVORN
event.author_shortname = v.Who.Author.shortName.text
event.author_ivorn = v.Who.AuthorIVORN.text
event.observatory_location_id = \
v.WhereWhen.ObsDataLocation.ObservatoryLocation.get('id')
event.coord_system = pos2d.system
event.ra = pos2d.ra
event.dec = pos2d.dec
event.error_radius = pos2d.err
event.how_description = v.How.Description
event.how_description = v.How.Description.text
event.how_reference_url = v.How.Reference.get('uri')
# Try to find a trigger_duration value
......
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-05-08 16:27
# This migration adds permission for the emfollow user to
# populate the spiir, MBTAOnline, and pycbc pipelines. Requested
# by Roberto de Pietri, 10/21/2019
from __future__ import unicode_literals
from django.db import migrations
USER_NAME = 'emfollow'
PIPELINES = [
'spiir',
'MBTAOnline',
'pycbc',
]
def add_permissions(apps, schema_editor):
User = apps.get_model('auth', 'User')
Permission = apps.get_model('auth', 'Permission')
UserObjectPermission = apps.get_model('guardian', 'UserObjectPermission')
Pipeline = apps.get_model('events', 'Pipeline')
ContentType = apps.get_model('contenttypes', 'ContentType')
# Get group
em = User.objects.get(username=USER_NAME)
perm = Permission.objects.get(codename='populate_pipeline')
ctype = ContentType.objects.get_for_model(Pipeline)
for pipeline in PIPELINES:
pipeline = Pipeline.objects.get(name=pipeline)
# Create UserObjectPermission
gop = UserObjectPermission.objects.create(user=em,
permission=perm, content_type=ctype, object_pk=pipeline.id)
def remove_permissions(apps, schema_editor):
User = apps.get_model('auth', 'User')
Permission = apps.get_model('auth', 'Permission')
UserObjectPermission = apps.get_model('guardian', 'UserObjectPermission')
Pipeline = apps.get_model('events', 'Pipeline')
ContentType = apps.get_model('contenttypes', 'ContentType')
# Get group
em = User.objects.get(username=USER_NAME)
perm = Permission.objects.get(codename='populate_pipeline')
ctype = ContentType.objects.get_for_model(Pipeline)
for pipeline in PIPELINES:
pipeline = Pipeline.objects.get(name=pipeline)
# Get UserObjectPermission and delete
uop = UserObjectPermission.objects.get(user=em,
permission=perm, content_type=ctype, object_pk=pipeline.id)
uop.delete()
class Migration(migrations.Migration):
dependencies = [
('ligoauth', '0005_update_emfollow_accounts'),
('guardian', '0005_authorize_raven_users_to_populate_pipelines'),
]
operations = [
migrations.RunPython(add_permissions, remove_permissions),
]
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