Oz Tiram added the comment:
@doerwalter, exactly. I found myself overwriting the relevant methods too many
times.
I usually did something like this:
class WorkCalendar(HTMLCalendar):
def formatmonthname(self, theyear, themonth, withyear=True,
style=r'class="month-head"'):
"""
Return a month name as a table row.
"""
monthname = super().formatmonthname(theyear, themonth, withyear)
regex = r'class\="month"'
return re.sub(regex, style, monthname, 1)
Using class attributes would nice, also considering that the days CSS classes
are defined as class attributes.
My intention was a few more class attributes (for the month header, and month)
and also change the existing code such that each day can have multiple CSS
classes and not just one.
I am willing to work on a PR for that if that sounds good and there is someone
who would be willing to merge it.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue30095>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com