

def handle(self, request, context):
    policy_id = self.initial['policy_id']
    name_or_id = (context.get('name') or policy_id)
    try:
        policy = api.fwaas.policy_update(request, policy_id, **context)
        msg = (_('Policy %s was successfully updated.') % name_or_id)
        LOG.debug(msg)
        messages.success(request, msg)
        return policy
    except Exception as e:
        msg = (_('Failed to update policy %(name)s: %(reason)s') % {
            'name': name_or_id,
            'reason': e,
        })
        LOG.error(msg)
        redirect = reverse(self.failure_url)
        exceptions.handle(request, msg, redirect=redirect)

dataset/ETHPy150Open openstack/horizon/openstack_dashboard/dashboards/project/firewalls/forms.py UpdatePolicy.handle/original