From cb75953e91f9709a84d5ed8cb193bb9c86dcc08a Mon Sep 17 00:00:00 2001 From: Mike Lang Date: Sat, 14 Nov 2020 08:39:51 +1100 Subject: [PATCH] thrimshim: Fix a bug preventing submissions When comparing old and new video tags, it errors because it's a list, not string. We change it to apply the transforms to all tags in the list, and also ignore changes in list ordering. --- thrimshim/thrimshim/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/thrimshim/thrimshim/main.py b/thrimshim/thrimshim/main.py index c6e6e4b..ab2952b 100644 --- a/thrimshim/thrimshim/main.py +++ b/thrimshim/thrimshim/main.py @@ -250,7 +250,11 @@ def update_row(ident, editor=None): for column in sheet_columns: if isinstance(old_row[column], datetime.datetime): old_row[column] = old_row[column].isoformat() - if new_row[column].lower().strip() != old_row[column].lower().strip(): + def normalize(value): + if isinstance(value, list): + return sorted(map(normalize, value)) + return value.lower().strip() + if normalize(new_row[column]) != normalize(old_row[column]): changes += '{}: {} => {}\n'.format(column, new_row[column], old_row[column]) if changes and not override_changes: return 'Sheet columns have changed since editing has begun. Please review changes\n' + changes, 409