Django

Code

Ticket #4813 (closed: fixed)

Opened 1 year ago

Last modified 9 months ago

Strange behaviour on locale using fastcgi and method=prefork

Reported by: bluszcz@jabberpl.org Assigned to: nobody
Milestone: Component: Internationalization
Version: SVN Keywords:
Cc: Triage Stage: Accepted
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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)

Attachments

Change History

07/11/07 01:26:26 changed by mtredinnick

  • needs_better_patch changed.
  • version changed from 0.96 to SVN.
  • needs_tests changed.
  • needs_docs changed.

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.

07/11/07 21:24:54 changed by Simon G. <dev@simon.net.nz>

  • stage changed from Unreviewed to Accepted.

08/19/07 09:11:54 changed by mtredinnick

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.

10/03/07 21:06:49 changed by mtredinnick

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

10/21/07 14:55:15 changed by mtredinnick

Might also be a dupe of #3539.

02/29/08 11:27:59 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

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.


Add/Change #4813 (Strange behaviour on locale using fastcgi and method=prefork)




Change Properties
Action