summaryrefslogtreecommitdiff
path: root/Mailman/htmlformat.py
diff options
context:
space:
mode:
authorbwarsaw2001-06-25 21:10:31 +0000
committerbwarsaw2001-06-25 21:10:31 +0000
commita753f08a668ef72e98ca904be85af11cca6a47e9 (patch)
treef636e04ace96357600afba0e0f857516c1076972 /Mailman/htmlformat.py
parent8c8a8b7e15b28325e820f0e5240202c5752a8f6c (diff)
downloadmailman-a753f08a668ef72e98ca904be85af11cca6a47e9.tar.gz
mailman-a753f08a668ef72e98ca904be85af11cca6a47e9.tar.zst
mailman-a753f08a668ef72e98ca904be85af11cca6a47e9.zip
Diffstat (limited to 'Mailman/htmlformat.py')
-rw-r--r--Mailman/htmlformat.py59
1 files changed, 29 insertions, 30 deletions
diff --git a/Mailman/htmlformat.py b/Mailman/htmlformat.py
index b07aef86e..e732c1a05 100644
--- a/Mailman/htmlformat.py
+++ b/Mailman/htmlformat.py
@@ -284,6 +284,7 @@ class Document(Container):
title = None
language = None
bgcolor = mm_cfg.WEB_BG_COLOR
+ suppress_head = 0
def set_language(self, lang=None):
self.language = lang
@@ -292,7 +293,7 @@ class Document(Container):
ctype = 'Content-type: text/html'
if self.language:
ctype += '; charset=' + Utils.GetCharSet(self.language)
- return ctype
+ return ctype + '\n'
def set_bgcolor(self, color):
self.bgcolor = color
@@ -301,40 +302,38 @@ class Document(Container):
self.title = title
def Format(self, indent=0, **kws):
- kws.setdefault('bgcolor', self.bgcolor)
- tab = ' ' * indent
- output = [self.get_content_type(),
- '',
- tab,
- '<HTML>',
- '<HEAD>'
- ]
- if self.title:
- output.append('%s<TITLE>%s</TITLE>' % (tab, self.title))
- output.append('%s</HEAD>' % tab)
- output.append('%s<BODY' % tab)
- quals = []
- # Default link colors
- if mm_cfg.WEB_VLINK_COLOR:
- kws.setdefault('vlink', mm_cfg.WEB_VLINK_COLOR)
- if mm_cfg.WEB_ALINK_COLOR:
- kws.setdefault('alink', mm_cfg.WEB_ALINK_COLOR)
- if mm_cfg.WEB_LINK_COLOR:
- kws.setdefault('alink', mm_cfg.WEB_LINK_COLOR)
- for k, v in kws.items():
- quals.append('%s="%s"' % (k, v))
- output.append('%s<BODY %s>' % (tab, SPACE.join(quals)))
+ output = [self.get_content_type()]
+ if not self.suppress_head:
+ kws.setdefault('bgcolor', self.bgcolor)
+ tab = ' ' * indent
+ output.extend([tab,
+ '<HTML>',
+ '<HEAD>'
+ ])
+ if self.title:
+ output.append('%s<TITLE>%s</TITLE>' % (tab, self.title))
+ output.append('%s</HEAD>' % tab)
+ quals = []
+ # Default link colors
+ if mm_cfg.WEB_VLINK_COLOR:
+ kws.setdefault('vlink', mm_cfg.WEB_VLINK_COLOR)
+ if mm_cfg.WEB_ALINK_COLOR:
+ kws.setdefault('alink', mm_cfg.WEB_ALINK_COLOR)
+ if mm_cfg.WEB_LINK_COLOR:
+ kws.setdefault('alink', mm_cfg.WEB_LINK_COLOR)
+ for k, v in kws.items():
+ quals.append('%s="%s"' % (k, v))
+ output.append('%s<BODY %s>' % (tab, SPACE.join(quals)))
+ # Always do this...
output.append(Container.Format(self, indent))
- output.append('%s</BODY>' % tab)
- output.append('%s</HTML>' % tab)
+ if not self.suppress_head:
+ output.append('%s</BODY>' % tab)
+ output.append('%s</HTML>' % tab)
return NL.join(output)
-
class HeadlessDocument(Document):
"""Document without head section, for templates that provide their own."""
- def Format(self, indent=0, **kws):
- return self.get_content_type() + '\n\n' + \
- Container.Format(self, indent)
+ suppress_head = 1
class StdContainer(Container):
def Format(self, indent=0):