# HG changeset patch # User John Rouillard # Date 1488079275 18000 # Node ID fe52cab8f5b503accc110fc9ed002c45c38758f8 # Parent 89b1870b1bc9cb9053d939ba622e7fa1d89099fd issue2550932 - html_calendar produces templating errors for bad date strings Changed code to trap and ignore unparsible dates. The calendar starts with today highlighted. diff -r 89b1870b1bc9 -r fe52cab8f5b5 CHANGES.txt --- a/CHANGES.txt Sat Feb 25 21:01:50 2017 -0500 +++ b/CHANGES.txt Sat Feb 25 22:21:15 2017 -0500 @@ -375,6 +375,9 @@ space separated list not comma separated. This fixes the format of the id url parameter when generated by indexargs_form. (John Rouillard) +- issue2550932 - html_calendar produces templating errors for bad date + strings. Fixed to ignore bad date and highlight todays date in the + calendar popup. 2016-01-11: 1.5.1 diff -r 89b1870b1bc9 -r fe52cab8f5b5 roundup/cgi/templating.py --- a/roundup/cgi/templating.py Sat Feb 25 21:01:50 2017 -0500 +++ b/roundup/cgi/templating.py Sat Feb 25 22:21:15 2017 -0500 @@ -3031,8 +3031,19 @@ template = request.form.getfirst("@template", "calendar") form = request.form.getfirst("form") property = request.form.getfirst("property") - curr_date = date.Date(date_str) # to highlight - display = date.Date(display) # to show + curr_date = "" + try: + # date_str and display can be set to an invalid value + # if user submits a value like "d4" and gets an edit error. + # If either or both invalid just ignore that we can't parse it + # and assign them to today. + curr_date = date.Date(date_str) # to highlight + display = date.Date(display) # to show + except ValueError: + # we couldn't parse the date + # just let the calendar display + curr_date = current_date + display = current_date day = display.day # for navigation