diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2011-11-21 12:42:09 +0000 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2011-11-21 12:42:09 +0000 |
| commit | 43c5d35315299330aaca1e2aab6fd2548eff7fcb (patch) | |
| tree | ea03594320b923928d97802c2152f6d409bd7c98 /tests | |
| parent | c5a899b190d1afa798efade499e8d00a5286fa28 (diff) | |
Fixed #17274 -- Accepted TIME_ZONE = None when USE_TZ = True. Thanks pressureman for the report.
This problem only occured when pytz is installed. It's still strongly recommended to define the correct time zone in TIME_ZONE in order to use pytz' implementation and not the approximation based on system time.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17134 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/modeltests/timezones/tests.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/modeltests/timezones/tests.py b/tests/modeltests/timezones/tests.py index a2f4ad2029..53b14045ab 100644 --- a/tests/modeltests/timezones/tests.py +++ b/tests/modeltests/timezones/tests.py @@ -774,6 +774,17 @@ class TemplateTests(BaseDateTimeTests): with timezone.override(ICT): self.assertEqual(tpl.render(ctx), "2011-09-01 at 20:20:20") + def test_localtime_with_time_zone_setting_set_to_none(self): + # Regression for #17274 + tpl = Template("{% load tz %}{{ dt }}") + ctx = Context({'dt': datetime.datetime(2011, 9, 1, 12, 20, 30, tzinfo=EAT)}) + + timezone._localtime = None + with self.settings(TIME_ZONE=None): + # the actual value depends on the system time zone of the host + self.assertTrue(tpl.render(ctx).startswith("2011")) + timezone._localtime = None + TemplateTests = override_settings(DATETIME_FORMAT='c', USE_L10N=False, USE_TZ=True)(TemplateTests) #@override_settings(DATETIME_FORMAT='c', USE_L10N=False, USE_TZ=False) |
