Ticket #5239: django-__builtin__.patch

File django-__builtin__.patch, 1.3 KB (added by leo.soto@…, 17 years ago)

Simple patch (uses the builtin module where builtins were previously used)

  • django/conf/__init__.py

    diff -r 8540e240a50c -r 52e84b58309f django/conf/__init__.py
    a b a list of all possible variables.  
    88
    99import os
    1010import time     # Needed for Windows
     11import __builtin__
    1112from django.conf import global_settings
    1213
    1314ENVIRONMENT_VARIABLE = "DJANGO_SETTINGS_MODULE"
    settings = LazySettings()  
    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

    diff -r 8540e240a50c -r 52e84b58309f django/utils/translation/trans_real.py
    a b def install():  
    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