Ejemplo n.º 1
0
    def update_address_scope(self, context, id, address_scope):
        a_s = address_scope['address_scope']
        address_scope = self._get_address_scope(context, id)
        if address_scope.shared and not a_s.get('shared', True):
            reason = _("Shared address scope can't be unshared")
            raise ext_address_scope.AddressScopeUpdateError(
                address_scope_id=id, reason=reason)

        address_scope.update_fields(a_s)
        address_scope.update()
        return self._make_address_scope_dict(address_scope)
Ejemplo n.º 2
0
    def update_address_scope(self, context, id, address_scope):
        a_s = address_scope['address_scope']
        with context.session.begin(subtransactions=True):
            address_scope = self._get_address_scope(context, id)
            if address_scope.shared and not a_s.get('shared', True):
                reason = _("Shared address scope can't be unshared")
                raise ext_address_scope.AddressScopeUpdateError(
                    address_scope_id=id, reason=reason)
            address_scope.update(a_s)

        return self._make_address_scope_dict(address_scope)
Ejemplo n.º 3
0
    def update_address_scope(self, context, id, address_scope):
        a_s = address_scope['address_scope']
        with db_api.context_manager.writer.using(context):
            address_scope = self._get_address_scope(context, id)
            if address_scope.shared and not a_s.get('shared', True):
                reason = _("Shared address scope can't be unshared")
                raise ext_address_scope.AddressScopeUpdateError(
                    address_scope_id=id, reason=reason)
            address_scope.update(a_s)

            return self._make_address_scope_dict(address_scope)