Ticket #10439: 10439-Dont-tzset-in-every-Settings-isntance-r10008.diff

File 10439-Dont-tzset-in-every-Settings-isntance-r10008.diff, 1.3 KB (added by Ramiro Morales, 16 years ago)

One attempt at fixing this by modifying django.conf.Settings.init

  • django/conf/__init__.py

    diff -r dd4af7c313f5 django/conf/__init__.py
    a b  
    5858    configured = property(configured)
    5959
    6060class Settings(object):
    61     def __init__(self, settings_module):
     61    def __init__(self, settings_module, modify_global_state=True):
    6262        # update this dict from global settings (but only for ALL_CAPS settings)
    6363        for setting in dir(global_settings):
    6464            if setting == setting.upper():
     
    9898                new_installed_apps.append(app)
    9999        self.INSTALLED_APPS = new_installed_apps
    100100
    101         if hasattr(time, 'tzset'):
     101        if modify_global_state and hasattr(time, 'tzset'):
    102102            # Move the time zone info into os.environ. See ticket #2315 for why
    103103            # we don't do this unconditionally (breaks Windows).
    104104            os.environ['TZ'] = self.TIME_ZONE
  • tests/regressiontests/app_loading/tests.py

    diff -r dd4af7c313f5 tests/regressiontests/app_loading/tests.py
    a b  
    77
    88>>> from django.conf import Settings
    99
    10 >>> s = Settings('test_settings')
     10>>> s = Settings('test_settings', modify_global_state=False)
    1111
    1212>>> s.INSTALLED_APPS
    1313['parent.app', 'parent.app1']
Back to Top