Skip to content
This repository has been archived by the owner on Mar 15, 2018. It is now read-only.

Make sure the extra translation queries follow db routing (bug 905887) #1144

Merged
merged 1 commit into from Sep 18, 2013

Conversation

diox
Copy link
Member

@diox diox commented Sep 16, 2013

https://bugzilla.mozilla.org/show_bug.cgi?id=905887

This should fix translations being empty for a small amount of time when creating a collection or an app, at least when creating using the API (since it pins its queries to master when authenticated)

A later fix would be to send the db currently used to the transformers to make them follow that, but that requires a django-queryset-transform patch.

Edit: bonus read, how translations work in Zamboni : https://gist.github.com/diox/e99d74a8e445032b49fa

connections[dbname].queries = []

with nested(mock.patch('multidb.get_slave', lambda: 'slave-2'),
use_master):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add a note that under Python 2.7 this is probably better as the multiple manager form of with? The docs say this is "quirky".

@robhudson
Copy link
Member

I've read up on db_for_read and nested contexts and this all looks good to me. r+. Nice tests to go along with it.

diox added a commit that referenced this pull request Sep 18, 2013
Make sure the extra translation queries follow db routing (bug 905887)
@diox diox merged commit 20eecce into mozilla:master Sep 18, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants