Skip to content

Commit

Permalink
add Hermes Broker by default & stub w/refer to installation instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
phycodurus committed Mar 20, 2023
1 parent 92b7b9b commit 6b7cc77
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions tom_alerts/alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
'tom_alerts.brokers.antares.ANTARESBroker',
'tom_alerts.brokers.gaia.GaiaBroker',
'tom_alerts.brokers.fink.FinkBroker',
'tom_alerts.brokers.hermes.HermesBroker',
]


Expand Down
32 changes: 32 additions & 0 deletions tom_alerts/brokers/hermes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from crispy_forms.layout import Layout, HTML

from tom_alerts.alerts import GenericBroker, GenericQueryForm, GenericAlert


class HermesQueryForm(GenericQueryForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper.inputs.pop()
self.helper.layout = Layout(
HTML('''
<p>
This plugin is a stub for the Hermes Broker plugin. In order to install the full plugin, please see the
instructions <a href="https://github.com/TOMToolkit/tom_hermes">here</a>.
</p>
'''),
HTML('''<a class="btn btn-outline-primary" href={% url 'tom_alerts:list' %}>Back</a>''')
)


class HermesBroker(GenericBroker):
name = 'Hermes'
form = HermesQueryForm

def fetch_alerts(self, parameters):
return iter([]), ''

def process_reduced_data(self, target, alert=None):
return

def to_generic_alert(self, alert):
return GenericAlert()

0 comments on commit 6b7cc77

Please sign in to comment.