Skip to content

Commit 659597e

Browse files
committed
Fix calendar CLI when locale set via env var but not --locale
1 parent e419817 commit 659597e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Lib/calendar.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ def formatmonthname(self, theyear, themonth, withyear=True):
648648
return super().formatmonthname(theyear, themonth, withyear)
649649

650650

651-
class _CLIDemoCalendar(LocaleTextCalendar):
651+
class _CLIDemoCalendar(TextCalendar):
652652
def __init__(self, highlight_day=None, *args, **kwargs):
653653
super().__init__(*args, **kwargs)
654654
self.highlight_day = highlight_day
@@ -752,6 +752,12 @@ def formatyear(self, theyear, w=2, l=1, c=6, m=3):
752752
return ''.join(v)
753753

754754

755+
class _CLIDemoLocaleCalendar(LocaleTextCalendar, _CLIDemoCalendar):
756+
def __init__(self, highlight_day=None, *args, **kwargs):
757+
super().__init__(*args, **kwargs)
758+
self.highlight_day = highlight_day
759+
760+
755761
# Support for old module level interface
756762
c = TextCalendar()
757763

@@ -893,7 +899,7 @@ def main(args=None):
893899
write(cal.formatyearpage(options.year, **optdict))
894900
else:
895901
if options.locale:
896-
cal = _CLIDemoCalendar(highlight_day=today, locale=locale)
902+
cal = _CLIDemoLocaleCalendar(highlight_day=today, locale=locale)
897903
else:
898904
cal = _CLIDemoCalendar(highlight_day=today)
899905
cal.setfirstweekday(options.first_weekday)

0 commit comments

Comments
 (0)