def handle(self, request, data): try: net_config = ast.literal_eval(data.pop('net_config')) if net_config[0] is not None: data.update(net.generate_join_existing_net(net_config)) env = api.environment_create(request, data) request.session['env_id'] = env.id messages.success(request, u'Created environment "{0}"'.format(data['name'])) return True except exc.HTTPConflict: msg = _('Environment with specified name already exists') LOG.exception(msg) exceptions.handle(request, ignore=True) messages.error(request, msg) return False except Exception: msg = _('Failed to create environment') LOG.exception(msg) exceptions.handle(request) messages.error(request, msg) return False