Ticket #5317: builtins.diff

File builtins.diff, 1.2 KB (added by Marty Alchin <gulopine@…>, 17 years ago)

Uses the __builtin__ module instead of the global __builtins__. This is fully compatible with CPython as well.

  • django/conf/__init__.py

     
    88
    99import os
    1010import time     # Needed for Windows
     11import __builtin__
    1112from django.conf import global_settings
    1213
    1314ENVIRONMENT_VARIABLE = "DJANGO_SETTINGS_MODULE"
     
    145146# from within this file would cause a circular import.
    146147def first_time_gettext(*args):
    147148    from django.utils.translation import gettext
    148     __builtins__['_'] = gettext
     149    setattr(__builtin__, '_', gettext)
    149150    return gettext(*args)
    150151
    151 __builtins__['_'] = first_time_gettext
     152setattr(__builtin__, '_', first_time_gettext)
  • django/utils/translation/trans_real.py

     
    419419    Installs the gettext function as the default translation function under
    420420    the name '_'.
    421421    """
    422     __builtins__['_'] = gettext
     422    import __builtin__
     423    setattr(__builtin__, '_', gettext)
    423424
    424425dot_re = re.compile(r'\S')
    425426def blankout(src, char):
Back to Top