Ticket #196: date_based_integer_months.patch

File date_based_integer_months.patch, 1.5 KB (added by Moof <moof@…>, 19 years ago)

Patch against r304 of date_based.py

  • date_based.py

     
    9292    """
    9393    try:
    9494        date = datetime.date(*time.strptime(year+month, '%Y%b')[:3])
    95     except ValueError:
    96         raise Http404
     95    except ValueError:
     96        try:
     97            date = datetime.date(int(year), int(month))
     98        except ValueError:
     99            raise Http404
    97100    mod = get_module(app_label, module_name)
    98101    now = datetime.datetime.now()
    99102    # Calculate first and last day of month, for use in a date-range lookup.
     
    144147    """
    145148    try:
    146149        date = datetime.date(*time.strptime(year+month+day, '%Y%b%d')[:3])
    147     except ValueError:
    148         raise Http404
     150    except ValueError:
     151        try:
     152            date = datetime.date(int(year), int(month), int(day))
     153        except ValueError:
     154            raise Http404
    149155    mod = get_module(app_label, module_name)
    150156    now = datetime.datetime.now()
    151157    lookup_kwargs = {
     
    196202    """
    197203    try:
    198204        date = datetime.datetime(*time.strptime(year+month+day, '%Y%b%d')[:3])
    199     except ValueError:
    200         raise Http404
     205    except ValueError:
     206        try:
     207            date = datetime.date(int(year), int(month), int(day))
     208        except ValueError:
     209            raise Http404
    201210    mod = get_module(app_label, module_name)
    202211    now = datetime.datetime.now()
    203212    lookup_kwargs = {
Back to Top