Ticket #6642: django_db_backends_utils.patch

File django_db_backends_utils.patch, 677 bytes (added by trbs, 17 years ago)
  • django/db/backends/util.py

     
    4646###############################################
    4747
    4848def typecast_date(s):
    49     return s and datetime.date(*map(int, s.split('-'))) or None # returns None if s is null
     49    sd = map(int, s.split('-'))
     50    if 0 in sd:
     51        # 0 is not a valid year, month or day
     52        return None # should raise error here ?
     53    return s and datetime.date(*sd) or None # returns None if s is null
    5054
    5155def typecast_time(s): # does NOT store time zone information
    5256    if not s: return None
Back to Top