Django

Code

Changeset 3186

Show
Ignore:
Timestamp:
06/21/06 06:11:03 (2 years ago)
Author:
mtredinnick
Message:

Fixed #2163 -- Corrected typo when handling datetimes with timezones in the timesince filter. Thanks, Alex Dedul.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/utils/timesince.py

    r3185 r3186  
    2525        t = time.localtime() 
    2626    if d.tzinfo: 
    27         tz = LocalTimezone(
     27        tz = LocalTimezone(d
    2828    else: 
    2929        tz = None 
  • django/trunk/tests/othertests/templates.py

    r3185 r3186  
    55from django.template import loader 
    66from django.utils.translation import activate, deactivate, install 
     7from django.utils.tzinfo import LocalTimezone 
    78from datetime import datetime, timedelta 
    89import traceback 
     
    5859        return "OtherClass.method" 
    5960 
    60 # NOW used by timesince tag tests. 
     61# NOW and NOW_tz are used by timesince tag tests. 
    6162NOW = datetime.now() 
     63NOW_tz = datetime.now(LocalTimezone(datetime.now())) 
    6264 
    6365# SYNTAX -- 
     
    545547    'timesince04' : ('{{ a|timesince:b }}', {'a':NOW + timedelta(days=2), 'b':NOW + timedelta(days=1)}, '1 day'), 
    546548    'timesince05' : ('{{ a|timesince:b }}', {'a':NOW + timedelta(days=2), 'b':NOW + timedelta(days=2)}, '0 minutes'), 
     549 
     550    # Check that timezone is respected 
     551    'timesince06' : ('{{ a|timesince:b }}', {'a':NOW_tz + timedelta(hours=8), 'b':NOW_tz}, '8 hours'), 
    547552 
    548553    ### TIMEUNTIL TAG ##################################################