def wrap_language(f):
@wraps(f)
def wrapper(request, *args, **kwargs):
company = get_company(request)
cs = retrieve_company_settings(company)
current_language = get_language()
activate(cs.language.lower())
response = f(request, *args, **kwargs)
activate(current_language)
return response
return wrapper
}}}
I've met a problem that when i frequently update any page of my website,
language sometimes changes randomly.
My gunicorn command:
{{{
gunicorn mysite.wsgi:application -b unix:/tmp/mysite.sock --workers 5
--threads 5
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/25131>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* cc: va-dev (added)
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/25131#comment:1>
* status: new => closed
* resolution: => needsinfo
Comment:
There's not enough information in this report to point to a bug in Django.
Please see TicketClosingReasons/UseSupportChannels and reopen the ticket
with more details (such as a sample project we can use to reproduce the
problem) if it turns out not to be a bug in your own code.
--
Ticket URL: <https://code.djangoproject.com/ticket/25131#comment:2>
Comment (by claudep):
In any case, try at least to enclose your `response = ` line in a
`try/finally` bloc, to restore the language even if an exception occurred.
--
Ticket URL: <https://code.djangoproject.com/ticket/25131#comment:3>