

def __init__(self, request, *args, **kwargs):
    super(AddL2PolicyForm, self).__init__(request, *args, **kwargs)
    try:
        policies = client.l3policy_list(request, tenant_id=request.user.tenant_id)
        policies = [(item['id'], ((item['name'] + ':') + item['id'])) for item in policies]
        self.fields['l3_policy_id'].choices = policies
    except Exception:
        msg = _('Failed to get L3 policy list')
        LOG.error(msg)
        exceptions.handle(request, msg, redirect=shortcuts.redirect)

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