Calendar module: HTMLCalendar overrides style sheet settings

S

Sibylle Koczian

Hello,

I want to create a calendar with special text and background color for
holidays and some other dates. This is for printing, but a HTML file
seems a good choice, independent of changing text processing software
and easier to code with Python than a script which fills in a Word or
OpenOffice template.

So I looked into the calendar module and made a LocalHTMLCalendar
subclass. Putting in additional style classes for "my" dates wasn't
difficult, but there is one thing I don't like at all: the methods
formatmonth() and formatyear() both return tables with explicit and ugly
formatting:

<table border="0" cellpadding="0" cellspacing="0" class="month">

and the same for class="year". This overrides the settings I make in the
style sheet.

Of course I can overwrite these methods, but why do it like this? The
output is made for use with a style sheet, so why use direct formatting
at this point?

Thanks for explanations and advice,
Sibylle
 
T

Terry Reedy

Sibylle said:
Hello,

I want to create a calendar with special text and background color for
holidays and some other dates. This is for printing, but a HTML file
seems a good choice, independent of changing text processing software
and easier to code with Python than a script which fills in a Word or
OpenOffice template.

So I looked into the calendar module and made a LocalHTMLCalendar
subclass. Putting in additional style classes for "my" dates wasn't
difficult, but there is one thing I don't like at all: the methods
formatmonth() and formatyear() both return tables with explicit and ugly
formatting:

<table border="0" cellpadding="0" cellspacing="0" class="month">

and the same for class="year". This overrides the settings I make in the
style sheet.

Of course I can overwrite these methods, but why do it like this? The
output is made for use with a style sheet, so why use direct formatting
at this point?

Calendar is an ancient and not-well-maintained module which may even
predate html. (There have even been suggestions that it be dropped.) I
would not be surprised if the 'css' parameter of formatyearpage were an
incomplete addition to the first version of HTMLCalendar. Feel free to
submit a patch to make the html work better with css, as long as css is
not made mandatory rather than optional. (Or should there be two html
classes? I do not know html well enough to know.)

Terry
 
S

Sibylle Koczian

Terry said:
Calendar is an ancient and not-well-maintained module which may even
predate html. (There have even been suggestions that it be dropped.) I
would not be surprised if the 'css' parameter of formatyearpage were an
incomplete addition to the first version of HTMLCalendar. Feel free to
submit a patch to make the html work better with css, as long as css is
not made mandatory rather than optional. (Or should there be two html
classes? I do not know html well enough to know.)

But the Calendar class and its subclasses, including HTMLCalendar, are
new in Python 2.5?! I'll try to change the formatting a bit, shouldn't
be a big thing, but who knows...

Regards
Sibylle
 
G

Gabriel Genellina

En Fri, 27 Mar 2009 17:48:33 -0300, Sibylle Koczian

(I would prefer it to be moved into the Tools directory)
But the Calendar class and its subclasses, including HTMLCalendar, are
new in Python 2.5?! I'll try to change the formatting a bit, shouldn't
be a big thing, but who knows...

new in Python 2.5??????

Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam March 2009
Mo Tu We Th Fr Sa Su
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31
 
S

Sibylle Koczian

Sibylle said:
Hello,

So I looked into the calendar module and made a LocalHTMLCalendar
subclass. Putting in additional style classes for "my" dates wasn't
difficult, but there is one thing I don't like at all: the methods
formatmonth() and formatyear() both return tables with explicit and ugly
formatting:

<table border="0" cellpadding="0" cellspacing="0" class="month">

I was quite wrong: this doesn't overwrite formatting by a style sheet.
Should have studied them a bit more first - sorry for the noise!

Regards
Sibylle
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,828
Latest member
LauraCastr

Latest Threads

Top