Opened 7 years ago

Closed 7 years ago

#17009 closed Bug (invalid)

New version caused ValueError: Incorrect timezone setting: GMT-8

Reported by: fangzhouxing@… Owned by: nobody
Component: Uncategorized Version: 1.3
Severity: Normal Keywords: timezone
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Aymeric Augustin)

I use Ubuntu 8.04. I have found the source code in /usr/lib/python2.5/site-packages/django/conf/ has changed since version 1.2.3 and caused this problem. The following code is added by version 1.3.0:

 zoneinfo_root = '/usr/share/zoneinfo'
            if (os.path.exists(zoneinfo_root) and not
                    os.path.exists(os.path.join(zoneinfo_root, *(self.TIME_ZONE.split('/'))))):
                raise ValueError("Incorrect timezone setting: %s" % self.TIME_ZONE)

Change History (1)

comment:1 Changed 7 years ago by Aymeric Augustin

Description: modified (diff)
Resolution: invalid
Status: newclosed

The docs link to a list of valid time zone choices. I think TIME_ZONE = "Etc/GMT-8" should do what you want.

The change you mention is a bugfix for #3415 introduced at r13722. It reveals the problem, but the root cause is still the fact that your TIME_ZONE setting is invalid. It isn't a bug in 1.3; the bug really was in 1.2 who should have warned you already.

Historically, Django hasn't sufficiently validated the value of settings.TIME_ZONE. It must be a timezone your system knows (ie. a file in /usr/share/zoneinfo) for time.tzset() to work properly. It must also be a timezone PostgreSQL knows if you're using the PostgreSQL backend.

I hope this helps. Thanks for the report!

Note: See TracTickets for help on using tickets.
Back to Top