diff -r 11b6601629d7 CHANGES.txt
--- a/CHANGES.txt Sat Jul 14 02:39:23 2012 +0200
+++ b/CHANGES.txt Wed Aug 01 00:22:43 2012 +0200
@@ -11,6 +11,7 @@
Fixed:
+- issue2550765: Don't show links in calendar that will fail. (Cédric Krier)
- issue2550759: Trailing punctuation is no longer included when URLs are
converted to links. (Ezio Melotti)
- issue2550574: Restore sample detectors removed in roundup 1.4.9
diff -r 11b6601629d7 roundup/cgi/templating.py
--- a/roundup/cgi/templating.py Sat Jul 14 02:39:23 2012 +0200
+++ b/roundup/cgi/templating.py Wed Aug 01 00:22:43 2012 +0200
@@ -2811,10 +2811,22 @@
day = display.day
# for navigation
- date_prev_month = display + date.Interval("-1m")
- date_next_month = display + date.Interval("+1m")
- date_prev_year = display + date.Interval("-1y")
- date_next_year = display + date.Interval("+1y")
+ try:
+ date_prev_month = display + date.Interval("-1m")
+ except ValueError:
+ date_prev_month = None
+ try:
+ date_next_month = display + date.Interval("+1m")
+ except ValueError:
+ date_next_month = None
+ try:
+ date_prev_year = display + date.Interval("-1y")
+ except ValueError:
+ date_prev_year = None
+ try:
+ date_next_year = display + date.Interval("+1y")
+ except ValueError:
+ date_next_year = None
res = []
@@ -2826,19 +2838,31 @@
res.append('
')
res.append(' ')
link = "&display=%s"%date_prev_month
- res.append(' < | '%(base_link,
- date_prev_month))
+ if date_prev_month:
+ res.append(' < | '
+ % (base_link, date_prev_month))
+ else:
+ res.append(' | ')
res.append(' %s | '%calendar.month_name[display.month])
- res.append(' > | '%(base_link,
- date_next_month))
+ if date_next_month:
+ res.append(' > | '
+ % (base_link, date_next_month))
+ else:
+ res.append(' | ')
# spacer
res.append(' | ')
# year
- res.append(' < | '%(base_link,
- date_prev_year))
+ if date_prev_year:
+ res.append(' < | '
+ % (base_link, date_prev_year))
+ else:
+ res.append(' | ')
res.append(' %s | '%display.year)
- res.append(' > | '%(base_link,
- date_next_year))
+ if date_next_year:
+ res.append(' > | '
+ % (base_link, date_next_year))
+ else:
+ res.append(' | ')
res.append(' ')
res.append(' |
')