From 8cfd1841969c9282b88d5cc51495527ac566caa8 Mon Sep 17 00:00:00 2001 From: Ostap Zherebetskyi Date: Mon, 6 Jan 2025 13:13:02 +0200 Subject: [PATCH] Update _id deletion comments to clarify cache update trigger --- osf/models/preprint.py | 6 +++--- osf_tests/management_commands/test_check_crossref_dois.py | 2 +- osf_tests/test_guid.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osf/models/preprint.py b/osf/models/preprint.py index bc75a8b9c1d..6dcf699acc3 100644 --- a/osf/models/preprint.py +++ b/osf/models/preprint.py @@ -313,7 +313,7 @@ def create(cls, provider, title, creator, description): ) versioned_guid.save() - del preprint._id + del preprint._id # trigger _id cache update return preprint @@ -426,7 +426,7 @@ def create_version(cls, create_from_guid, auth): ) guid_version.save() - del preprint._id + del preprint._id # trigger _id cache update # Add contributors for contributor_info in latest_version.contributor_set.exclude(user=latest_version.creator).values('visible', 'user_id', '_order'): @@ -442,7 +442,7 @@ def create_version(cls, create_from_guid, auth): guid_obj.object_id = preprint.pk guid_obj.content_type = ContentType.objects.get_for_model(preprint) guid_obj.save() - del preprint._id + del preprint._id # trigger _id cache update return preprint, data_to_update diff --git a/osf_tests/management_commands/test_check_crossref_dois.py b/osf_tests/management_commands/test_check_crossref_dois.py index aca48cc6cbd..05cc3dfdbf5 100644 --- a/osf_tests/management_commands/test_check_crossref_dois.py +++ b/osf_tests/management_commands/test_check_crossref_dois.py @@ -32,7 +32,7 @@ def stuck_preprint(self): guid._id = 'guid0' guid.save() - del preprint._id + del preprint._id # trigger _id cache update preprint.save() return preprint diff --git a/osf_tests/test_guid.py b/osf_tests/test_guid.py index 952990d7b0b..66eb21ec7be 100644 --- a/osf_tests/test_guid.py +++ b/osf_tests/test_guid.py @@ -565,6 +565,6 @@ def test_versioned_preprint_id_property(self, creator, preprint_provider): assert preprint._id == expected_guid GuidVersionsThrough.objects.filter(guid=preprint_guid).delete() - del preprint._id + del preprint._id # trigger _id cache update assert preprint._id is None