Context Navigation


Opened 3 months ago

Last modified 6 days ago

#36504 assigned Bug

LazyObject for storages with override_settings does not behave as described

Reported by: Dennis Brinkman Owned by: khosro_o
Component: File uploads/storage Version: 5.2
Severity: Normal Keywords:
Cc: Dennis Brinkman Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

Dear Django Team,

While working on my own Django project using storages, I found an error in the [Managing Files - Using a callable](https://docs.djangoproject.com/en/5.2/topics/files/#using-a-callable) documentation (the last two code blocks to be precise). As it turns out, the solution of using the override_settings decorator does not work as advertised while testing FileFields.

I have made a minimal Django project (https://github.com/Brinky5678/django_incorrect_docs_demo) for easy replication. In the readme, I have included steps to how to replicate, as well as the cause of why I think it does not work as expected.

This ticket is not meant to provide a workable solution using the override_settings decorator. Instead, I merely wish to have the documentation updated in such a way that the warning of the storage callables being evaluated during model loading remains, but without the incorrect documentation about using LazyObjects.

Change History (11)

comment:1 by Clifford Gama, 3 months ago

Triage Stage: UnreviewedAccepted

Thanks for the report and the test project. I confirmed using the test project that the documented example doesn't work. For reference, the section was added by #36269.

comment:2 by khosro_o, 8 weeks ago

I'm working on this ticket.

comment:3 by Clifford Gama, 6 weeks ago

Has patch: set

comment:4 by Clifford Gama, 6 weeks ago

Patch needs improvement: set

comment:5 by khosro_o, 5 weeks ago

Patch needs improvement: unset

comment:6 by Clifford Gama, 4 weeks ago

Patch needs improvement: set

comment:7 by khosro_o, 4 weeks ago

Patch needs improvement: unset

comment:8 by Clifford Gama, 4 weeks ago

Owner: set to khosro_o
Status: newassigned
Triage Stage: AcceptedReady for checkin

comment:9 by Sarah Boyce, 3 weeks ago

Patch needs improvement: set
Triage Stage: Ready for checkinAccepted

comment:10 by khosro_o, 8 days ago

Patch needs improvement: unset

comment:11 by Sarah Boyce, 6 days ago

Component: DocumentationFile uploads/storage
Patch needs improvement: set
Summary: Docs: LazyObject for storages with override_settings does not behave as describedLazyObject for storages with override_settings does not behave as described
Type: Cleanup/optimizationBug

Related #36269 #36622

Following #36622, I agree that the code change is preferable and I like how this would make us write a test for this case
Note that we may want to revert the docs for versions where this is not fixed

Note: See TracTickets for help on using tickets.
Back to Top