Skip to content

Commit

Permalink
Update _id deletion comments to clarify cache update trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
Ostap-Zherebetskyi committed Jan 6, 2025
1 parent a5440c0 commit 8cfd184
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions osf/models/preprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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'):
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion osf_tests/management_commands/test_check_crossref_dois.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion osf_tests/test_guid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 8cfd184

Please sign in to comment.