Closed Bug 970657 Opened 10 years ago Closed 8 years ago

Fetch translations on the same db the queryset is currently in

Categories

(Marketplace Graveyard :: Code Quality, defect, P4)

x86_64
Linux
defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: mat, Unassigned)

Details

(Whiteboard: [marketplace-transition])

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
Closed: 8 years ago
Resolution: --- → WONTFIX
Whiteboard: [marketplace-transition]
You need to log in before you can comment on or make changes to this bug.