Ticket #3415: t3415-variant1-check-tzname.diff

File t3415-variant1-check-tzname.diff, 738 bytes (added by Dennis Kaarsemaker, 15 years ago)

Variant one: check time.tzname

  • django/conf/__init__.py

     
    107107            # we don't do this unconditionally (breaks Windows).
    108108            os.environ['TZ'] = self.TIME_ZONE
    109109            time.tzset()
     110            # Check whether the timezone is valid (Bug #3415)
     111            utc_timezones = ('UTC','Universal','Zulu','Etc/UTC','Etc/Universal','Etc/Zulu')
     112            if time.tzname == ('UTC', 'UTC') and self.TIME_ZONE not in utc_timezones:
     113                raise ValueError(_("Incorrect timezone setting: %s") % self.TIME_ZONE)
    110114
    111115    def get_all_members(self):
    112116        return dir(self)
Back to Top