Ticket #3415: t3415-variant2-check-zoneinfo.diff

File t3415-variant2-check-zoneinfo.diff, 836 bytes (added by Dennis Kaarsemaker, 15 years ago)

Variant 2: check /usr/share/zoneinfo

  • django/conf/__init__.py

     
    103103        self.INSTALLED_APPS = new_installed_apps
    104104
    105105        if hasattr(time, 'tzset'):
     106            # Check whether the timezone is valid (Bug #3415)
     107            zoneinfo_root = '/usr/share/zoneinfo'
     108            if os.path.exists(zoneinfo_root) and not \
     109               os.path.exists(os.path.join(zoneinfo_root, *(self.TIME_ZONE.split('/')))):
     110                raise ValueError("Incorrect timezone setting: %s" % self.TIME_ZONE)
    106111            # Move the time zone info into os.environ. See ticket #2315 for why
    107112            # we don't do this unconditionally (breaks Windows).
    108113            os.environ['TZ'] = self.TIME_ZONE
Back to Top