5 from xml.parsers
import expat
11 def __init__(self, title="CMS SDT pages", style=None, outFile=sys.stdout) :
17 print "\n================================================================================\n"
47 for fmt
in self.
cols :
48 self.
format +=
"%"+str(fmt)+
"s "
49 print self.
format % tuple(colLabels)
54 print self.
format % tuple(args)
67 def __init__(self, title="CMS SDT pages ", style=None, outFile=sys.stdout, scriptCode='') :
86 self.outFile.write(
"Content-Type: text/html" +
'\n')
87 self.outFile.write(
'\n')
88 self.outFile.write(
"<html> " +
'\n')
89 self.outFile.write(
"</html> " +
'\n')
95 self.outFile.write(
"<hr />" +
'\n')
98 def write(self, arg="", bold=False) :
103 self.outFile.write( arg +
'\n')
108 self.outFile.write(
"<br /> <br /> " +
'\n')
113 self.outFile.write(
"<b> " + arg +
" </b>" +
'\n')
118 self.outFile.write(
"<h1> " + arg +
" </h1>" +
'\n')
123 self.outFile.write(
"<h2> " + arg +
" </h2>" +
'\n')
128 self.outFile.write(
"<h3> " + arg +
" </h3>" +
'\n')
133 self.outFile.write(
'<a name="' + ref +
'"> </a>')
136 def startTable(self, colSizes, colLabels, id=None, cls=None, tableAttr=None) :
138 tableString =
'<table '
140 tableString += tableAttr
142 tableString +=
' id="'+id+
'" '
144 tableString +=
' class="'+cls+
'" '
146 self.outFile.write( tableString +
'\n')
148 self.outFile.write(
" <thead>\n <tr>" +
'\n')
149 for col
in colLabels :
150 self.outFile.write(
" <th> <b>" + col +
"</b> </th>" +
'\n')
151 self.outFile.write(
" </tr>\n</thead>" +
'\n')
152 self.outFile.write(
" <tbody>" +
'\n')
159 self.outFile.write(
' <tr class="'+cls+
'"> \n')
161 self.outFile.write(
" <tr>" +
'\n')
163 if string.strip(str(arg)) ==
"" : arg =
" "
164 if bold: self.outFile.write(
'<td class=cellbold> ' )
165 else: self.outFile.write(
" <td> " )
166 self.outFile.write( arg )
168 self.outFile.write(
" </td>" +
'\n')
169 self.outFile.write(
" </tr> " +
'\n')
175 self.outFile.write(
" <tr>" +
'\n')
176 for arg, cellStyle
in zip(args, styles):
177 if string.strip(str(arg)) ==
"" : arg =
" "
178 cellStyle = cellStyle.strip()
179 if cellStyle !=
'' : self.outFile.write(
'<td class='+cellStyle+
'> ' )
180 else: self.outFile.write(
" <td> " )
181 self.outFile.write( arg )
182 self.outFile.write(
" </td>" +
'\n')
183 self.outFile.write(
" </tr> " +
'\n')
189 self.outFile.write(
"</tbody>" +
'\n')
190 self.outFile.write(
"</table>" +
'\n')
197 self.outFile.write(
"<html> " +
'\n')
199 self.outFile.write(
"<head> " +
'\n')
202 self.outFile.write( self.
style +
'\n')
204 self.outFile.write(
"<TITLE>" + self.
title +
"</TITLE>" +
'\n')
207 self.outFile.write(
"</head> " +
'\n')
208 self.outFile.write(
"<body>" +
'\n')
217 self.outFile.write(
"</body>" +
'\n')
218 self.outFile.write(
"</html> " +
'\n')