Code

Opened 7 years ago

Closed 6 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)

Attachments (0)

Change History (6)

comment:1 Changed 7 years ago by mtredinnick

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Version changed from 0.96 to SVN

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 7 years ago by Simon G. <dev@…>

  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 7 years ago 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.

comment:4 Changed 7 years ago by mtredinnick

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

comment:5 Changed 6 years ago by mtredinnick

Might also be a dupe of #3539.

comment:6 Changed 6 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

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 Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.