networks: Handle unknown connections gracefully

When trying to edit connection of unknown type show an error and return
to connections list instead of trying to filling in some fields and
doing badly.
This commit is contained in:
Sunil Mohan Adapa 2015-08-22 21:04:01 +05:30
parent 2c23b0ecb4
commit f93de11c6a

View File

@ -65,6 +65,11 @@ def edit(request, uuid):
'Connection not found.')) 'Connection not found.'))
return redirect(reverse_lazy('networks:index')) return redirect(reverse_lazy('networks:index'))
if connection.get_connection_type() not in network.CONNECTION_TYPE_NAMES:
messages.error(request,
_('This type of connection is not yet understood.'))
return redirect(reverse_lazy('networks:index'))
form = None form = None
form_data = {'name': connection.get_id()} form_data = {'name': connection.get_id()}