#26787: Access to deleted attribute triggers a query
-------------------------------------+-------------------------------------
Reporter: spectras | Owner: nobody
Type: Uncategorized | Status: new
Component: Database layer | Version: 1.10
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by spectras):
* needs_docs: => 0
* needs_tests: => 0
* needs_better_patch: => 0
Old description:
> This is a consequence of the implementation of #26207.
>
> Now, all fields have a `DeferredAttribute` descriptor. This has the
> consequence that this will trigger a model reload:
>
> {{{
> obj = MyModel.objects.get(pk=1)
> del obj.title
> obj.title
> }}}
>
> Up to version 1.9 (included), this code would raise an `AttributeError`.
> Now it silently triggers a query to reload the field from the database.
>
> Is this intended? If so, it should probably be added to the release
> notes.
New description:
This is a consequence of the implementation of #26207 in PR
[https://github.com/django/django/pull/6118 6118]
Now, all fields have a `DeferredAttribute` descriptor. This has the
consequence that this will trigger a model reload:
{{{
obj = MyModel.objects.get(pk=1)
del obj.title
obj.title
}}}
Up to version 1.9 (included), this code would raise an `AttributeError`.
Now it silently triggers a query to reload the field from the database.
Is this intended? If so, it should probably be added to the release notes.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/26787#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/066.945e8237640a5a5143c6a29be5691738%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.