Opened 9 years ago

Closed 9 years ago

#4813 closed (fixed)

Strange behaviour on locale using fastcgi and method=prefork

Reported by: bluszcz@… Owned by: nobody
Component: Internationalization Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

During using manage.py runfcgi method=prefork there is a strange behaviour, propably connected with gettext cache - random requests serve untranslated string. With method=threaded everything is ok. I hacked utils/translation/trans_real.py file for my own needed and it works:

def gettext(message):
    """
    This function will be patched into the builtins module to provide the _
    helper function. It will use the current thread as a discriminator to find
    the translation object to use. If no current translation is activated, the
    message will be run through the default translation object.
    """


    from django.conf import settings
    _default = translation(settings.LANGUAGE_CODE)
    return _default.gettext(message)

Change History (6)

comment:1 Changed 9 years ago by Malcolm Tredinnick

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Version: 0.96SVN

Looking at the comment and the use of _default, this isn't version 0.96 code at all. It's something more recent. Changing the version string.

The above change won't work in general, since it assumes you only ever want to use settings.LANGUAGE_CODE. It also wallpapers over whatever the real problem might be. I have no idea what the root cause is at the moment, though. Needs more investigation.

comment:2 Changed 9 years ago by Simon G. <dev@…>

Triage Stage: UnreviewedAccepted

comment:3 Changed 9 years ago by Malcolm Tredinnick

I wonder if this is a symptom of the same problem as #4796? Not sure they're dupes yet, but problems in the i18n code not being applied uniformly is a common feature.

comment:4 Changed 9 years ago by Malcolm Tredinnick

Can you please check if this problem has been fixed by [6446], which is the fix for #4796.

comment:5 Changed 9 years ago by Malcolm Tredinnick

Might also be a dupe of #3539.

comment:6 Changed 9 years ago by Malcolm Tredinnick

Resolution: fixed
Status: newclosed

Given the lack of response or confirmation in over four months, I'm going to close this. Can be reopened if somebody can repeat the problem with a recent subversion checkout.

Note: See TracTickets for help on using tickets.
Back to Top