diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2010-02-26 15:33:27 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2010-02-26 15:33:27 +0000 |
| commit | 46cc7021a8ab60190d81e9d7e039cd84efbafb23 (patch) | |
| tree | 5f809c291af834fb5a2cd2d122ca849c26062ae3 /django | |
| parent | 0ff624a3cb075800e6c84cf80e36b085e23cf270 (diff) | |
Fixed #1480 -- Added the ability to use the system timezone. Thanks to Ramiro Morales for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12602 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
| -rw-r--r-- | django/conf/__init__.py | 2 | ||||
| -rw-r--r-- | django/conf/project_template/settings.py | 2 | ||||
| -rw-r--r-- | django/db/backends/postgresql/base.py | 2 | ||||
| -rw-r--r-- | django/db/backends/postgresql_psycopg2/base.py | 2 |
4 files changed, 5 insertions, 3 deletions
diff --git a/django/conf/__init__.py b/django/conf/__init__.py index 24bcd40973..d94f6e9867 100644 --- a/django/conf/__init__.py +++ b/django/conf/__init__.py @@ -102,7 +102,7 @@ class Settings(object): new_installed_apps.append(app) self.INSTALLED_APPS = new_installed_apps - if hasattr(time, 'tzset'): + if hasattr(time, 'tzset') and getattr(self, 'TIME_ZONE'): # Move the time zone info into os.environ. See ticket #2315 for why # we don't do this unconditionally (breaks Windows). os.environ['TZ'] = self.TIME_ZONE diff --git a/django/conf/project_template/settings.py b/django/conf/project_template/settings.py index 361a36b36b..ee08e9712b 100644 --- a/django/conf/project_template/settings.py +++ b/django/conf/project_template/settings.py @@ -23,6 +23,8 @@ DATABASES = { # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # although not all choices may be available on all operating systems. +# On Unix systems, a value of None will cause Django to use the same +# timezone as the operating system. # If running in a Windows environment this must be set to the same as your # system time zone. TIME_ZONE = 'America/Chicago' diff --git a/django/db/backends/postgresql/base.py b/django/db/backends/postgresql/base.py index 500ba5ce03..ec59dd6848 100644 --- a/django/db/backends/postgresql/base.py +++ b/django/db/backends/postgresql/base.py @@ -119,7 +119,7 @@ class DatabaseWrapper(BaseDatabaseWrapper): set_tz = False settings_dict = self.settings_dict if self.connection is None: - set_tz = True + set_tz = settings_dict.get('TIME_ZONE') if settings_dict['NAME'] == '': from django.core.exceptions import ImproperlyConfigured raise ImproperlyConfigured("You need to specify NAME in your Django settings file.") diff --git a/django/db/backends/postgresql_psycopg2/base.py b/django/db/backends/postgresql_psycopg2/base.py index b6823f2303..09b9eb4990 100644 --- a/django/db/backends/postgresql_psycopg2/base.py +++ b/django/db/backends/postgresql_psycopg2/base.py @@ -113,7 +113,7 @@ class DatabaseWrapper(BaseDatabaseWrapper): set_tz = False settings_dict = self.settings_dict if self.connection is None: - set_tz = True + set_tz = settings_dict.get('TIME_ZONE') if settings_dict['NAME'] == '': from django.core.exceptions import ImproperlyConfigured raise ImproperlyConfigured("You need to specify NAME in your Django settings file.") |
