#34540: [feature request] Run FileField storage callable during runtime and not
during buildtime
-------------------------------------+-------------------------------------
Reporter: Vasanth | Owner: nobody
Type: New feature | Status: new
Component: File | Version: 4.2
uploads/storage |
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
-------------------------------------+-------------------------------------
Description changed by Vasanth:
Old description:
> If the storage callable can be invoked during runtime similar to the
> "upload_to", it can allow us to choose the storage to use dynamically.
> This is particularly helpful for SaaS services which prefer maintaining
> independent storages per client/subdomain.
>
> Something like, the following snippet where ''local_state.tenant'' is
> threading local() which holds the name of the tenant for each request
>
> {{{
> def tenant_storage():
> tenant = getattr(local_state, "tenant", "default")
> return storages[tenant]
> }}}
New description:
If the storage callable can be invoked during runtime similar to the
"upload_to", it can allow us to choose the storage to use dynamically.
This is particularly helpful for SaaS services which prefer maintaining
independent storages per client/subdomain.
Something like, the following snippet where ''local_state.tenant'' is
threading local() which holds the name of the tenant for each request
{{{
def tenant_storage(instance, filename):
tenant = getattr(local_state, "tenant", "default")
return storages[tenant]
}}}
--
--
Ticket URL: <https://code.djangoproject.com/ticket/34540#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 view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/01070187e789fa5d-35d913eb-9b75-413a-889b-d1d9e28a4e51-000000%40eu-central-1.amazonses.com.