Ignore:
Timestamp:
Aug 30, 2011, 7:05:10 PM (13 years ago)
Author:
rick
Message:

Default to now() for the time beeing if we cannot find a proper date in the filename.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/django_gheat/gheat/management/commands/import_datafile.py

    r9631 r9632  
    6666def process_date(datestr):
    6767  for strptime in strptime_choices:
    68     try: return datetime.datetime.strptime(datestr,strptime)
    69     except ValueError: pass
    70   # Start nagging we cannot parse the entries
    71   raise CommandError("Invalid date '%s', options: %s" % (datestr, strptime_choices))
     68    try:
     69      return datetime.datetime.strptime(datestr,strptime)
     70    except ValueError:
     71      pass
     72  logger.error("Invalid date '%s', options: %s, using: now()", datestr, strptime_choices)
     73  return datetime.datetime.now()
    7274
    7375
Note: See TracChangeset for help on using the changeset viewer.