Remove catching of AttributeError in DescriptorWrapper

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`.
This commit is contained in:
Maarten ter Huurne 2024-06-12 16:46:03 +02:00
parent a6b0a2aff7
commit 14cf1b0d40

View file

@ -50,10 +50,7 @@ class DescriptorWrapper:
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)