Django

Code

Changeset 3117

Show
Ignore:
Timestamp:
06/10/06 19:33:44 (2 years ago)
Author:
mtredinnick
Message:

Fixed #2127 -- Made datetime filters fail silently when passed empty strings or
None. Thanks, Gary Wilson.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/template/defaultfilters.py

    r2927 r3117  
    331331    "Formats a date according to the given format" 
    332332    from django.utils.dateformat import format 
     333    if not value: 
     334        return '' 
    333335    if arg is None: 
    334336        arg = settings.DATE_FORMAT 
     
    338340    "Formats a time according to the given format" 
    339341    from django.utils.dateformat import time_format 
     342    if not value: 
     343        return '' 
    340344    if arg is None: 
    341345        arg = settings.TIME_FORMAT 
     
    345349    'Formats a date as the time since that date (i.e. "4 days, 6 hours")' 
    346350    from django.utils.timesince import timesince 
     351    if not value: 
     352        return '' 
    347353    return timesince(value) 
    348354