Ticket #1480: t1480-r7662.diff

File t1480-r7662.diff, 4.6 KB (added by Ramiro Morales, 16 years ago)

Updated patch so it applies cleanly to trunk as of r7662 and adding New in Django development version note to documentation

  • django/conf/__init__.py

    diff -r 86e9c4dac609 django/conf/__init__.py
    a b  
    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 86e9c4dac609 django/conf/project_template/settings.py
    a b  
    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 86e9c4dac609 django/db/backends/postgresql/base.py
    a b  
    8585    def _cursor(self, settings):
    8686        set_tz = False
    8787        if self.connection is None:
    88             set_tz = True
     88            set_tz = hasattr(settings, 'TIME_ZONE') and settings.TIME_ZONE
    8989            if settings.DATABASE_NAME == '':
    9090                from django.core.exceptions import ImproperlyConfigured
    9191                raise ImproperlyConfigured("You need to specify DATABASE_NAME in your Django settings file.")
  • django/db/backends/postgresql_psycopg2/base.py

    diff -r 86e9c4dac609 django/db/backends/postgresql_psycopg2/base.py
    a b  
    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 86e9c4dac609 docs/settings.txt
    a b  
    10581058not necessarily the timezone of the server. For example, one server may serve
    10591059multiple Django-powered sites, each with a separate time-zone setting.
    10601060
     1061**New in Django development version:** This setting can also be left undefined
     1062or set to ``None`` for deployment scenarios in which you need the timezone to
     1063remain in the server's timezone.
     1064
    10611065Normally, Django sets the ``os.environ['TZ']`` variable to the time zone you
    10621066specify in the  ``TIME_ZONE`` setting. Thus, all your views and models will
    1063 automatically operate in the correct time zone. However, if you're using the
    1064 manual configuration option (see below), Django will *not* touch the ``TZ``
    1065 environment variable, and it'll be up to you to ensure your processes are
    1066 running in the correct environment.
     1067automatically operate in the correct time zone. However, in the following two
     1068scenarios:
     1069
     1070* If you leave the ``TIME_ZONE`` setting undefined or set it to ``None``
     1071* If you're using the manual configuration option (see below_)
     1072
     1073Django will *not* touch the ``TZ`` environment variable, and it'll be up to you
     1074to ensure your processes are running in the correct environment.
    10671075
    10681076.. note::
    10691077    Django cannot reliably use alternate time zones in a Windows environment.
     
    11331141      purely for performance.
    11341142    * Don't reinvent an already-existing setting.
    11351143
     1144.. _below:
     1145
    11361146Using settings without setting DJANGO_SETTINGS_MODULE
    11371147=====================================================
    11381148
     
    11631173
    11641174Consequently, when configured via ``settings.configure()``, Django will not
    11651175make any modifications to the process environment variables. (See the
    1166 explanation of ``TIME_ZONE``, above, for why this would normally occur.) It's
     1176explanation of TIME_ZONE_, above, for why this would normally occur.) It's
    11671177assumed that you're already in full control of your environment in these cases.
    11681178
    11691179Custom default settings
Back to Top