Skip to content

Commit

Permalink
Revert "Delete objects when processing done so that associated object…
Browse files Browse the repository at this point in the history
…s are reported correctly"

This reverts commit 7646761.
  • Loading branch information
matthew-li committed Aug 2, 2023
1 parent 7646761 commit d2e28a5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
1 change: 0 additions & 1 deletion coldfront/core/user/utils_/merge_users/class_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def run(self):
self._run_special_handling()
if self._dst_obj:
self._dst_obj.save()
self._src_obj.delete()

def _get_settable_if_falsy_attrs(self):
"""Return a list of attributes that, if falsy in the
Expand Down
12 changes: 3 additions & 9 deletions coldfront/core/user/utils_/merge_users/runner.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from django.contrib.auth.models import User
from django.contrib.admin.utils import NestedObjects
from django.core.exceptions import ObjectDoesNotExist
from django.db import DEFAULT_DB_ALIAS
from django.db import transaction

Expand Down Expand Up @@ -125,14 +124,9 @@ def _process_src_user_dependencies(self):

class_handler_factory = ClassHandlerFactory()

try:
# Block other threads from retrieving this object until the end
# of the transaction.
obj = obj.__class__.objects.select_for_update().get(pk=obj.pk)
except ObjectDoesNotExist:
# The object was deleted in a cascading fashion. Process it
# anyway for reporting purposes.
pass
# Block other threads from retrieving this object until the end of
# the transaction.
obj = obj.__class__.objects.select_for_update().get(pk=obj.pk)

try:
handler = class_handler_factory.get_handler(
Expand Down

0 comments on commit d2e28a5

Please sign in to comment.