Ticket #9065: 9065-combined.diff
File 9065-combined.diff, 2.4 KB (added by , 16 years ago) |
---|
-
django/utils/timesince.py
29 29 if d.__class__ is not datetime.datetime: 30 30 d = datetime.datetime(d.year, d.month, d.day) 31 31 32 if now and now.__class__ is not datetime.datetime: 33 now = datetime.datetime(now.year, now.month, now.day) 34 32 35 if not now: 33 36 if d.tzinfo: 34 37 now = datetime.datetime.now(LocalTimezone(d)) -
tests/regressiontests/templates/filters.py
7 7 consistent. 8 8 """ 9 9 10 from datetime import date time, timedelta10 from datetime import date, datetime, timedelta 11 11 12 12 from django.utils.tzinfo import LocalTimezone, FixedOffset 13 13 from django.utils.safestring import mark_safe … … 28 28 now = datetime.now() 29 29 now_tz = datetime.now(LocalTimezone(now)) 30 30 now_tz_i = datetime.now(FixedOffset((3 * 60) + 15)) # imaginary time zone 31 today = date.today() 32 31 33 return { 32 34 # Default compare with datetime.now() 33 35 'filter-timesince01' : ('{{ a|timesince }}', {'a': datetime.now() + timedelta(minutes=-1, seconds = -10)}, '1 minute'), … … 55 57 'filter-timesince15' : ('{{ a|timesince:b }}', {'a': now, 'b': now_tz_i}, ''), 56 58 'filter-timesince16' : ('{{ a|timesince:b }}', {'a': now_tz_i, 'b': now}, ''), 57 59 60 # Regression for #9065 61 'filter-timesince17' : ('{{ a|timesince:b }}', {'a': today, 'b': today}, '0 minutes'), 62 'filter-timesince18' : ('{{ a|timesince:b }}', {'a': today, 'b': today + timedelta(hours=24)}, '1 day'), 63 58 64 # Default compare with datetime.now() 59 65 'filter-timeuntil01' : ('{{ a|timeuntil }}', {'a':datetime.now() + timedelta(minutes=2, seconds = 10)}, '2 minutes'), 60 66 'filter-timeuntil02' : ('{{ a|timeuntil }}', {'a':(datetime.now() + timedelta(days=1, seconds = 10))}, '1 day'), … … 290 296 'join03': (r'{{ a|join:" & " }}', {'a': ['alpha', 'beta & me']}, 'alpha & beta & me'), 291 297 'join04': (r'{% autoescape off %}{{ a|join:" & " }}{% endautoescape %}', {'a': ['alpha', 'beta & me']}, 'alpha & beta & me'), 292 298 } 293