ignore unknown attributes in htmlwriter. patch by jem, thanks.
authorralf@brainbot.com
Tue Nov 18 10:51:41 2008 +0100 (7 weeks ago)
changeset 17935623e767caa8
parent 17922b9d1949e71f
child 1794946e1f776e1c
child 179957d59c40f04b
ignore unknown attributes in htmlwriter. patch by jem, thanks.
mwlib/htmlwriter.py
       1 --- a/mwlib/htmlwriter.py	Mon Nov 17 18:56:35 2008 +0100
       2 +++ b/mwlib/htmlwriter.py	Tue Nov 18 10:51:41 2008 +0100
       3 @@ -30,7 +30,7 @@
       4              self.math_renderer = math_renderer
       5      
       6      def _write(self, s):
       7 -        self.out.write(cgi.escape(s))
       8 +        self.out.write(cgi.escape(s.encode("utf8")))
       9  
      10      def getCategoryList(self, obj):
      11          categories = list(set(c.target for c in obj.find(parser.CategoryLink)))
      12 @@ -39,7 +39,10 @@
      13                      
      14      def write(self, obj):
      15          m = "write" + obj.__class__.__name__
      16 -        m=getattr(self, m)
      17 +        m=getattr(self, m, None)
      18 +        if not m:
      19 +            log.warn("No method to write object:", obj.__class__.__name__)
      20 +            return
      21          m(obj)
      22  
      23      def ignore(self, obj):