Skip to content

Commit

Permalink
Remove catching of AttributeError in DescriptorWrapper
Browse files Browse the repository at this point in the history
This catch was introduced in #367, but subsequent discussion
in #370, #381 and #382 suggests that it wasn't the proper solution.

Now that `AbstractModelTrackerTests` is re-enabled and passing,
it becomes clear that `AttributeError` is no longer raised during
unit testing when using a recent Django version. Therefore I think
it is safe to remove the `try`/`except`.
  • Loading branch information
mthuurne committed Jun 12, 2024
1 parent a6b0a2a commit 14cf1b0
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions model_utils/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ def __get__(self, instance, owner):
if instance is None:
return self
was_deferred = self.field_name in instance.get_deferred_fields()
try:
value = self.descriptor.__get__(instance, owner)
except AttributeError:
value = self.descriptor
value = self.descriptor.__get__(instance, owner)
if was_deferred:
tracker_instance = getattr(instance, self.tracker_attname)
tracker_instance.saved_data[self.field_name] = lightweight_deepcopy(value)
Expand Down

0 comments on commit 14cf1b0

Please sign in to comment.