From 3c61e2d2d49bbd8b34120991273e6bd779e0148e Mon Sep 17 00:00:00 2001 From: hmeland Date: Fri, 4 Jun 1999 15:13:43 +0000 Subject: New class: QuotedContainer(Container). It's Format() method returns contained objects representation after putting them through Utils.QuoteHyperChars(). Changed class Preformatted to be a subclass of the new QuotedContainer class. This hopefully will make the admindb pages display emails containing "<", ">" etc. characters correctly. It will lose if someone tries to use other HTML elements inside a Preformatted container. --- Mailman/htmlformat.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Mailman/htmlformat.py b/Mailman/htmlformat.py index 78693423f..0905dabde 100644 --- a/Mailman/htmlformat.py +++ b/Mailman/htmlformat.py @@ -30,6 +30,7 @@ for python and, recursively, for nested HTML formatting objects. import types import string import mm_cfg +import Utils # Format an arbitrary object. @@ -304,6 +305,15 @@ class StdContainer(Container): return output +class QuotedContainer(Container): + def Format(self, indent=0): + # If I don't start a new I ignore indent + output = '<%s>%s' % ( + self.tag, + Utils.QuoteHyperChars(Container.Format(self, indent)), + self.tag) + return output + class Header(StdContainer): def __init__(self, num, *items): self.items = items @@ -321,7 +331,7 @@ class Bold(StdContainer): class Italic(StdContainer): tag = 'em' -class Preformatted(StdContainer): +class Preformatted(QuotedContainer): tag = 'pre' class Subscript(StdContainer): -- cgit v1.3.1