

def handle(self, request, context):
    url = reverse('horizon:project:network_policy:index')
    try:
        params = context['network_service_params']
        p = []
        if (len(params) > 0):
            for item in params:
                values = [i.split(':')[1] for i in item.split(',')]
                values = {
                    'type': values[0],
                    'name': values[1],
                    'value': values[2],
                }
                p.append(values)
        context['network_service_params'] = p
        if context.get('name'):
            context['name'] = html.escape(context['name'])
        if context.get('description'):
            context['description'] = html.escape(context['description'])
        client.create_networkservice_policy(request, **context)
        msg = _('Service policy created successfully!')
        LOG.debug(msg)
        return http.HttpResponseRedirect(url)
    except Exception as e:
        msg = (_('Failed to create service policy. %s') % str(i))
        LOG.error(msg)
        exceptions.handle(request, msg, redirect=url)

dataset/ETHPy150Open openstack/group-based-policy-ui/gbpui/panels/network_policy/forms.py CreateServicePolicyForm.handle/VarMisuse@227/301 `e`->`i`