Ticket #7062: patch_tz.diff

File patch_tz.diff, 908 bytes (added by durdinator, 7 years ago)
  • core/handlers/modpython.py

     
    11import os
     2import time
    23from pprint import pformat
    34
    45from django import http
     
    148149        # that use settings now can work
    149150        from django.conf import settings
    150151
     152        # Ensure the TZ environment variable is set appropriately for every request
     153        if hasattr(time, 'tzset'):
     154            # Move the time zone info into os.environ. See ticket #2315 for why
     155            # we don't do this unconditionally (breaks Windows).
     156            os.environ['TZ'] = self.TIME_ZONE
     157            time.tzset()
     158
    151159        # if we need to set up middleware, now that settings works we can do it now.
    152160        if self._request_middleware is None:
    153161            self.load_middleware()
Back to Top