From 769bcde449ba3c068222fbaf01b9b100e8f05cd2 Mon Sep 17 00:00:00 2001 From: cindy oneill Date: Mon, 23 Jun 2014 15:32:25 -0600 Subject: [PATCH] alarms detail and edit catch monclient exception, pep8 changes --- monitoring/alarms/constants.py | 1 - monitoring/alarms/forms.py | 4 ++-- monitoring/alarms/templates/alarms/_create.html | 4 ++-- monitoring/alarms/templates/alarms/_edit.html | 4 ++-- monitoring/alarms/views.py | 11 +++++------ 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/monitoring/alarms/constants.py b/monitoring/alarms/constants.py index 26a74b7c..d7030b8e 100644 --- a/monitoring/alarms/constants.py +++ b/monitoring/alarms/constants.py @@ -15,7 +15,6 @@ # under the License. - URL_PREFIX = 'horizon:overcloud:alarms:' TEMPLATE_PREFIX = 'overcloud/alarms/' diff --git a/monitoring/alarms/forms.py b/monitoring/alarms/forms.py index 01a15835..9b81eabd 100644 --- a/monitoring/alarms/forms.py +++ b/monitoring/alarms/forms.py @@ -141,7 +141,7 @@ class NotificationCreateWidget(forms.Select): if options: output += options output += '' - output += 'X' + output += 'X' output += '' idx += 1 else: @@ -152,7 +152,7 @@ class NotificationCreateWidget(forms.Select): if options: output += options output += '' - output += 'X' + output += 'X' output += '' output += '' label = unicode(_("+ Add more")) diff --git a/monitoring/alarms/templates/alarms/_create.html b/monitoring/alarms/templates/alarms/_create.html index b2af278e..9606f4a9 100644 --- a/monitoring/alarms/templates/alarms/_create.html +++ b/monitoring/alarms/templates/alarms/_create.html @@ -31,11 +31,11 @@ $('#add_notification_button').click(function(){ name = "notifications_" + num; options = $("#id_notifications_" + (num - 1)).html(); options = options.replace('selected="selected"',''); - row = 'X' + row = 'X' $('#notification_table tr:last').after(row); return false; }); -$('#notification_table').on('click', '#remove_notification_button', (function(event){ +$('#notification_table').on('click', '#remove_notif_button', (function(event){ var target = $(event.target.parentNode.parentNode); target.remove(); return false; diff --git a/monitoring/alarms/templates/alarms/_edit.html b/monitoring/alarms/templates/alarms/_edit.html index 2c43cd44..d7db2561 100644 --- a/monitoring/alarms/templates/alarms/_edit.html +++ b/monitoring/alarms/templates/alarms/_edit.html @@ -31,11 +31,11 @@ $('#add_notification_button').click(function(){ name = "notifications_" + num; options = $("#id_notifications_" + (num - 1)).html(); options = options.replace('selected="selected"',''); - row = 'X' + row = 'X' $('#notification_table tr:last').after(row); return false; }); -$('#notification_table').on('click', '#remove_notification_button', (function(event){ +$('#notification_table').on('click', '#remove_notif_button', (function(event){ var target = $(event.target.parentNode.parentNode); target.remove(); return false; diff --git a/monitoring/alarms/views.py b/monitoring/alarms/views.py index 26d723ce..43e49e97 100644 --- a/monitoring/alarms/views.py +++ b/monitoring/alarms/views.py @@ -30,6 +30,7 @@ from horizon import exceptions from horizon import forms from horizon import tables +import monclient.exc as exc from monitoring import api from .tables import AlarmsTable from .tables import AlarmHistoryTable @@ -259,7 +260,8 @@ class AlarmDetailView(forms.ModalFormView): self.request, id) notifications.append(notification) - except exceptions.NOT_FOUND: + # except exceptions.NOT_FOUND: + except exc.HTTPException: msg = _("Notification %s has already been deleted.") % id notifications.append({"id": id, "name": unicode(msg), @@ -312,12 +314,9 @@ class AlarmEditView(forms.ModalFormView): self.request, id) notifications.append(notification) - except exceptions.NOT_FOUND: + # except exceptions.NOT_FOUND: + except exc.HTTPException: msg = _("Notification %s has already been deleted.") % id - notifications.append({"id": id, - "name": unicode(msg), - "type": "", - "address": ""}) self._object["notifications"] = notifications return self._object except Exception: