Fetch translations on the same db the queryset is currently in

RESOLVED WONTFIX

Status

Marketplace
Code Quality
P4
normal
RESOLVED WONTFIX
5 years ago
3 years ago

People

(Reporter: mat, Unassigned)

Tracking

x86_64
Linux
Points:
---

Details

(Whiteboard: [marketplace-transition])

(Reporter)

Description

5 years ago
The translations transformer is hardcoded to use whatever database the router uses for reads. This means that if we specifically request another db with `using(dbname)` the translations won't follow that.

It's not a super big deal since it still obeys db pinning (because the router will answer "default" instead of "slave" for reads when pinned) but it's still annoying and can cause incoherent data in some weird cases.

Fixing that will require:
- Making the _with_translations() transform a real transform (probably needs to be the first one though) and not one set dynamically in get_query_set() in apps/amo/models.py (otherwise it's called too soon before we know the real db to use)
- Calling functools.partial or similar magic to pass the db to get_trans()
- Using the dbname passed in get_trans() if there is one.
- Making some funky tests
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → WONTFIX
Whiteboard: [marketplace-transition]
You need to log in before you can comment on or make changes to this bug.