Method: calendar.HTMLCalendar.formatyearpage
Calls: 3, Exceptions: 0, Paths: 2Back
Path 1: 2 calls (0.67)
2004 (2)
3 (2)
'calendar.css' (2)
'ascii' (1) 'utf-8' (1)
bytes (2)
1def formatyearpage(self, theyear, width=3, css='calendar.css', encoding=None):
2 """
3 Return a formatted year as a complete HTML page.
4 """
5 if encoding is None:
6 encoding = sys.getdefaultencoding()
7 v = []
8 a = v.append
9 a('<?xml version="1.0" encoding="%s"?>\n' % encoding)
10 a('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n')
11 a('<html>\n')
12 a('<head>\n')
13 a('<meta http-equiv="Content-Type" content="text/html; charset=%s" />\n' % encoding)
14 if css is not None:
15 a('<link rel="stylesheet" type="text/css" href="%s" />\n' % css)
16 a('<title>Calendar for %d</title>\n' % theyear)
17 a('</head>\n')
18 a('<body>\n')
19 a(self.formatyear(theyear, width))
20 a('</body>\n')
21 a('</html>\n')
22 return ''.join(v).encode(encoding, "xmlcharrefreplace")
Path 2: 1 calls (0.33)
2004 (1)
3 (1)
'calendar.css' (1)
None (1)
bytes (1)
1def formatyearpage(self, theyear, width=3, css='calendar.css', encoding=None):
2 """
3 Return a formatted year as a complete HTML page.
4 """
5 if encoding is None:
6 encoding = sys.getdefaultencoding()
7 v = []
8 a = v.append
9 a('<?xml version="1.0" encoding="%s"?>\n' % encoding)
10 a('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n')
11 a('<html>\n')
12 a('<head>\n')
13 a('<meta http-equiv="Content-Type" content="text/html; charset=%s" />\n' % encoding)
14 if css is not None:
15 a('<link rel="stylesheet" type="text/css" href="%s" />\n' % css)
16 a('<title>Calendar for %d</title>\n' % theyear)
17 a('</head>\n')
18 a('<body>\n')
19 a(self.formatyear(theyear, width))
20 a('</body>\n')
21 a('</html>\n')
22 return ''.join(v).encode(encoding, "xmlcharrefreplace")