diff --git a/sandbox/grist/dropdown_condition.py b/sandbox/grist/dropdown_condition.py index a031d4b4f5..30ef271dbf 100644 --- a/sandbox/grist/dropdown_condition.py +++ b/sandbox/grist/dropdown_condition.py @@ -1,5 +1,6 @@ import json import logging +import usertypes from predicate_formula import NamedEntity, parse_predicate_formula_json, TreeConverter import predicate_formula @@ -38,12 +39,7 @@ def perform_dropdown_condition_renames(useractions, renames): continue # Find out what table this column refers to and belongs to. - if col.type.startswith("Ref:"): - ref_table_id = col.type[4:] - elif col.type.startswith("RefList:"): - ref_table_id = col.type[8:] - else: - ref_table_id = None + ref_table_id = usertypes.get_referenced_table_id(col.type) self_table_id = col.parentId.tableId def renamer(subject): diff --git a/sandbox/grist/usertypes.py b/sandbox/grist/usertypes.py index d617b927f7..d599a22273 100644 --- a/sandbox/grist/usertypes.py +++ b/sandbox/grist/usertypes.py @@ -63,6 +63,13 @@ def wrapper(method): return method return wrapper +def get_referenced_table_id(col_type): + if col_type.startswith("Ref:"): + return col_type[4:] + if col_type.startswith("RefList:"): + return col_type[8:] + return None + def ifError(value, value_if_error): """