Ticket #1480: 1480_time_zone.diff

File 1480_time_zone.diff, 4.8 KB (added by Ramiro Morales, 16 years ago)
  • django/conf/__init__.py

    diff -r e7e8eff2050e django/conf/__init__.py
    a b class Settings(object):  
    110110                new_installed_apps.append(app)
    111111        self.INSTALLED_APPS = new_installed_apps
    112112
    113         if hasattr(time, 'tzset'):
     113        if hasattr(time, 'tzset') and hasattr(self, 'TIME_ZONE') and self.TIME_ZONE:
    114114            # Move the time zone info into os.environ. See ticket #2315 for why
    115115            # we don't do this unconditionally (breaks Windows).
    116116            os.environ['TZ'] = self.TIME_ZONE
  • django/conf/project_template/settings.py

    diff -r e7e8eff2050e django/conf/project_template/settings.py
    a b DATABASE_PORT = '' # Set to  
    1919# Local time zone for this installation. Choices can be found here:
    2020# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
    2121# although not all choices may be available on all operating systems.
     22# On Unix systems you can leave it undefined or set it to None if
     23# you want the timezone to remain equal to the server's timezone.
    2224# If running in a Windows environment this must be set to the same as your
    2325# system time zone.
    2426TIME_ZONE = 'America/Chicago'
  • django/db/backends/postgresql/base.py

    diff -r e7e8eff2050e django/db/backends/postgresql/base.py
    a b class DatabaseWrapper(BaseDatabaseWrappe  
    8282    def _cursor(self, settings):
    8383        set_tz = False
    8484        if self.connection is None:
    85             set_tz = True
     85            set_tz = hasattr(settings, 'TIME_ZONE') and settings.TIME_ZONE
    8686            if settings.DATABASE_NAME == '':
    8787                from django.core.exceptions import ImproperlyConfigured
    8888                raise ImproperlyConfigured("You need to specify DATABASE_NAME in your Django settings file.")
  • django/db/backends/postgresql_psycopg2/base.py

    diff -r e7e8eff2050e django/db/backends/postgresql_psycopg2/base.py
    a b class DatabaseWrapper(BaseDatabaseWrappe  
    5353    def _cursor(self, settings):
    5454        set_tz = False
    5555        if self.connection is None:
    56             set_tz = True
     56            set_tz = hasattr(settings, 'TIME_ZONE') and settings.TIME_ZONE
    5757            if settings.DATABASE_NAME == '':
    5858                from django.core.exceptions import ImproperlyConfigured
    5959                raise ImproperlyConfigured("You need to specify DATABASE_NAME in your Django settings file.")
  • docs/settings.txt

    diff -r e7e8eff2050e docs/settings.txt
    a b not necessarily the timezone of the serv  
    10301030not necessarily the timezone of the server. For example, one server may serve
    10311031multiple Django-powered sites, each with a separate time-zone setting.
    10321032
     1033This setting can also be left undefined or set to ``None`` for deployment
     1034scenarios in which you need the timezone to remain in the server's timezone.
     1035
    10331036Normally, Django sets the ``os.environ['TZ']`` variable to the time zone you
    10341037specify in the  ``TIME_ZONE`` setting. Thus, all your views and models will
    1035 automatically operate in the correct time zone. However, if you're using the
    1036 manual configuration option (see below), Django will *not* touch the ``TZ``
    1037 environment variable, and it'll be up to you to ensure your processes are
    1038 running in the correct environment.
     1038automatically operate in the correct time zone. However, Django will *not*
     1039touch the ``TZ`` environment variable, and it'll be up to you to ensure your
     1040processes are running in the correct environment in the following two scenarios:
     1041
     1042* If you leave the ``TIME_ZONE`` setting undefined or set it to ``None``
     1043* If you're using the manual configuration option (see below_)
    10391044
    10401045.. note::
    10411046    Django cannot reliably use alternate time zones in a Windows environment.
    Django apps. Just follow these conventio  
    11051110      purely for performance.
    11061111    * Don't reinvent an already-existing setting.
    11071112
     1113.. _below:
     1114
    11081115Using settings without setting DJANGO_SETTINGS_MODULE
    11091116=====================================================
    11101117
    application.  
    11351142
    11361143Consequently, when configured via ``settings.configure()``, Django will not
    11371144make any modifications to the process environment variables. (See the
    1138 explanation of ``TIME_ZONE``, above, for why this would normally occur.) It's
     1145explanation of TIME_ZONE_, above, for why this would normally occur.) It's
    11391146assumed that you're already in full control of your environment in these cases.
    11401147
    11411148Custom default settings
Back to Top