

def handle(self, request, context):
    try:
        if (context['subnet_id'] == ''):
            del p['subnet_id']
        if (context['cidr'] == ''):
            del context['cidr']
        routes = context['external_routes']
        p = []
        if (len(routes) > 0):
            for item in routes:
                values = [i.split(':')[1] for i in item.split(',')]
                values = {
                    'destination': values[0],
                    'nexthop': values[1],
                }
                p.append(values)
        context['external_routes'] = p
        external_segment = client.create_externalconnectivity(request, **context)
        msg = _('External Connectivity successfully created.')
        LOG.debug(msg)
        messages.success(request, msg)
        return external_segment
    except Exception as e:
        msg = str(e)
        LOG.error(msg)
        exceptions.handle(request, msg, redirect=shortcuts.redirect)

dataset/ETHPy150Open openstack/group-based-policy-ui/gbpui/panels/network_policy/forms.py CreateExternalConnectivityForm.handle/VarMisuse@31/38 `context`->`p`