From 2868ee2fa1ab21f96965f324a3b6e3721db119a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaros=C5=82aw=20Sadzi=C5=84ski?= Date: Tue, 16 Jul 2024 16:00:37 +0200 Subject: [PATCH] (core) Replacing python3 specifc code Summary: Removing JSONDecodeError type from python code that is python3 only. Test Plan: Existing Reviewers: paulfitz, georgegevoian Reviewed By: paulfitz, georgegevoian Subscribers: paulfitz Differential Revision: https://phab.getgrist.com/D4298 --- sandbox/grist/dropdown_condition.py | 2 +- sandbox/grist/useractions.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sandbox/grist/dropdown_condition.py b/sandbox/grist/dropdown_condition.py index c590db71..409486c3 100644 --- a/sandbox/grist/dropdown_condition.py +++ b/sandbox/grist/dropdown_condition.py @@ -35,7 +35,7 @@ def perform_dropdown_condition_renames(useractions, renames): try: widget_options = json.loads(col.widgetOptions) dc_formula = widget_options["dropdownCondition"]["text"] - except (json.JSONDecodeError, KeyError): + except (ValueError, KeyError): continue # Find out what table this column refers to and belongs to. diff --git a/sandbox/grist/useractions.py b/sandbox/grist/useractions.py index 3c01b996..19bfc1c0 100644 --- a/sandbox/grist/useractions.py +++ b/sandbox/grist/useractions.py @@ -708,9 +708,6 @@ class UserActions(object): for col_rec, new_formula in sorted(six.iteritems(formula_updates)): col_updates.setdefault(col_rec, {}).setdefault('formula', new_formula) - acl.perform_acl_rule_renames(self, renames) - dropdown_condition.perform_dropdown_condition_renames(self, renames) - update_pairs = col_updates.items() # Disallow most changes to summary group-by columns, except to match the underlying column. @@ -752,6 +749,10 @@ class UserActions(object): self.doBulkUpdateFromPairs(table_id, update_pairs) + if renames: + acl.perform_acl_rule_renames(self, renames) + dropdown_condition.perform_dropdown_condition_renames(self, renames) + for table_id in rebuild_summary_tables: table = self._engine.tables[table_id] self._engine._update_table_model(table, table.user_table)