

def handle(self, request, context):
    url = reverse('horizon:project:network_policy:index')
    try:
        if context.get('name'):
            context['name'] = html.escape(context['name'])
        if context.get('description'):
            context['description'] = html.escape(context['description'])
        client.create_natpool(request, **context)
        msg = _('NAT Pool created successfully!')
        LOG.debug(msg)
        messages.success(request, msg)
        return http.HttpResponseRedirect(url)
    except Exception as e:
        msg = (_('Failed to NAT Pool. %s') % str(e))
        LOG.error(msg)
        exceptions.handle(request, msg, redirect=url)

dataset/ETHPy150Open openstack/group-based-policy-ui/gbpui/panels/network_policy/forms.py CreateNATPoolForm.handle/original