mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Refactor Table.Record[Set] classes
Summary: Dealing with some things that bothered and sometimes confused me: Make Table.Record[Set] provide the table argument automatically Remove the classes from UserTable because they're not used anywhere and the Table/UserTable distinction is already confusing. They're not documented for users and they don't show up in autocomplete. Remove RecordSet.Record because it was confusing me where that attribute was being set, but also this means .Record will work properly for users with columns named 'Record'. Test Plan: existing tests Reviewers: dsagal Reviewed By: dsagal Differential Revision: https://phab.getgrist.com/D2913
This commit is contained in:
@@ -421,7 +421,7 @@ class ReferenceColumn(BaseReferenceColumn):
|
||||
return typed_value
|
||||
# For a Reference, values must either refer to an existing record, or be 0. In all tables,
|
||||
# the 0 index will contain the all-defaults record.
|
||||
return self._target_table.Record(self._target_table, typed_value, self._relation)
|
||||
return self._target_table.Record(typed_value, self._relation)
|
||||
|
||||
def _update_references(self, row_id, old_value, new_value):
|
||||
if old_value:
|
||||
@@ -452,7 +452,7 @@ class ReferenceListColumn(BaseReferenceColumn):
|
||||
# If we refer to an invalid table, return integers rather than fail completely.
|
||||
if not self._target_table:
|
||||
return typed_value
|
||||
return self._target_table.RecordSet(self._target_table, typed_value, self._relation)
|
||||
return self._target_table.RecordSet(typed_value, self._relation)
|
||||
|
||||
def _raw_get_without(self, row_id, target_row_ids):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user