[Django] #25131: language changes randomly

9 views
Skip to first unread message

Django

unread,
Jul 16, 2015, 3:57:04 AM7/16/15
to django-...@googlegroups.com
#25131: language changes randomly
--------------------------------------+--------------------
Reporter: va-dev | Owner: nobody
Type: Uncategorized | Status: new
Component: Internationalization | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+--------------------
I use decorator for temporal language activation:
{{{
from django.utils.translation import get_language, activate

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.

Django

unread,
Jul 16, 2015, 3:58:08 AM7/16/15
to django-...@googlegroups.com
#25131: language changes randomly
-------------------------------------+-------------------------------------

Reporter: va-dev | Owner: nobody
Type: Uncategorized | Status: new
Component: | Version: 1.8
Internationalization |
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
-------------------------------------+-------------------------------------
Changes (by va-dev):

* cc: va-dev (added)
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/25131#comment:1>

Django

unread,
Jul 16, 2015, 7:36:08 AM7/16/15
to django-...@googlegroups.com
#25131: language changes randomly
-------------------------------------+-------------------------------------
Reporter: va-dev | Owner: nobody
Type: Uncategorized | Status: closed
Component: | Version: 1.8
Internationalization |
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage:
| Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* 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>

Django

unread,
Jul 16, 2015, 1:41:19 PM7/16/15
to django-...@googlegroups.com
#25131: language changes randomly
-------------------------------------+-------------------------------------
Reporter: va-dev | Owner: nobody

Type: Uncategorized | Status: closed
Component: | Version: 1.8
Internationalization |
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage:
| Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

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>

Reply all
Reply to author
Forward
0 new messages