forked from openlp/openlp
Style fix. Thanks to trb for nice example on he's branch.
This commit is contained in:
parent
5710e2aefd
commit
06ff33ac96
@ -426,20 +426,19 @@ class HttpConnection(object):
|
|||||||
"""
|
"""
|
||||||
Send an alert.
|
Send an alert.
|
||||||
"""
|
"""
|
||||||
for plugin in self.parent.plugin.pluginManager.plugins:
|
plugin = self.parent.plugin.pluginManager.get_plugin_by_name("alerts")
|
||||||
if plugin.name == u'alerts' and \
|
if plugin.status == PluginStatus.Active:
|
||||||
plugin.status != PluginStatus.Active:
|
try:
|
||||||
# Forget about the request, alerts is turned off.
|
text = json.loads(
|
||||||
return HttpResponse(json.dumps(
|
self.url_params[u'data'][0])[u'request'][u'text']
|
||||||
{u'results': {u'success': False}}),
|
except KeyError, ValueError:
|
||||||
{u'Content-Type': u'application/json'})
|
return HttpResponse(code=u'400 Bad Request')
|
||||||
try:
|
text = urllib.unquote(text)
|
||||||
text = json.loads(self.url_params[u'data'][0])[u'request'][u'text']
|
Receiver.send_message(u'alerts_text', [text])
|
||||||
except KeyError, ValueError:
|
success = True
|
||||||
return HttpResponse(code=u'400 Bad Request')
|
else:
|
||||||
text = urllib.unquote(text)
|
success = False
|
||||||
Receiver.send_message(u'alerts_text', [text])
|
return HttpResponse(json.dumps({u'results': {u'success': success}}),
|
||||||
return HttpResponse(json.dumps({u'results': {u'success': True}}),
|
|
||||||
{u'Content-Type': u'application/json'})
|
{u'Content-Type': u'application/json'})
|
||||||
|
|
||||||
def controller(self, type, action):
|
def controller(self, type, action):
|
||||||
|
Loading…
Reference in New Issue
Block a user