Projet

Général

Profil

0001-sql-only-the-last-Evolution-object-can-be-changed-65.patch

Pierre Ducroquet, 07 juin 2022 09:59

Télécharger (1,2 ko)

Voir les différences:

Subject: [PATCH] sql: only the last Evolution object can be changed (#65744)

 wcs/sql.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
wcs/sql.py
2605 2605
        self.clean_live_evolution_items()
2606 2606

  
2607 2607
        if self._evolution:
2608
            for evo in self._evolution:
2608
            # iterate in reverse order to find out where the changes are required
2609
            # this first loop will find the last evolution object with an id
2610
            change_idx = 0
2611
            for i in range(len(self._evolution) - 1, -1, -1):
2612
                if hasattr(self._evolution[i], '_sql_id'):
2613
                    change_idx = i
2614
                    break
2615
            # now we can save all objects after this one
2616
            for evo in self._evolution[change_idx:]:
2609 2617
                sql_dict = {}
2610 2618
                if hasattr(evo, '_sql_id'):
2611 2619
                    sql_dict.update({'id': evo._sql_id})
2612
-