(core) Simple Python 3 compatibility changes

Summary: Changes that move towards python 3 compatibility that are easy to review without much thought

Test Plan: The tests

Reviewers: dsagal

Reviewed By: dsagal

Differential Revision: https://phab.getgrist.com/D2873
This commit is contained in:
Alex Hall
2021-06-22 17:12:25 +02:00
parent cc04c6481a
commit 16f297a250
66 changed files with 551 additions and 437 deletions

View File

@@ -2,6 +2,8 @@ import json
import types
from collections import namedtuple
import six
import depend
import objtypes
import usertypes
@@ -302,7 +304,7 @@ class ChoiceListColumn(BaseColumn):
def set(self, row_id, value):
# When a JSON string is loaded, set it to a tuple parsed from it. When a list is loaded,
# convert to a tuple to keep values immutable.
if isinstance(value, basestring) and value.startswith('['):
if isinstance(value, six.string_types) and value.startswith(u'['):
try:
value = tuple(json.loads(value))
except Exception: