appy.pod: bugfix for encoding of XML attributes (see https://bugs.launchpad.net/appy/+bug/779448).

This commit is contained in:
Gaetan Delannay 2011-06-17 02:00:25 +02:00
parent de8df53f42
commit a20af9e28a

View file

@ -19,6 +19,7 @@
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
import re import re
from xml.sax.saxutils import quoteattr
from appy.pod import PodError, XML_SPECIAL_CHARS from appy.pod import PodError, XML_SPECIAL_CHARS
from appy.pod.elements import * from appy.pod.elements import *
from appy.pod.actions import IfAction, ElseAction, ForAction, VariableAction, \ from appy.pod.actions import IfAction, ElseAction, ForAction, VariableAction, \
@ -141,7 +142,7 @@ class Buffer:
def dumpStartElement(self, elem, attrs={}): def dumpStartElement(self, elem, attrs={}):
self.write('<%s' % elem) self.write('<%s' % elem)
for name, value in attrs.items(): for name, value in attrs.items():
self.write(' %s="%s"' % (name, value)) self.write(' %s=%s' % (name, quoteattr(value)))
self.write('>') self.write('>')
def dumpEndElement(self, elem): def dumpEndElement(self, elem):
@ -162,9 +163,6 @@ class Buffer:
else: else:
self.write(c) self.write(c)
def dumpAttribute(self, name, value):
self.write(''' %s="%s" ''' % (name, value))
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
class FileBuffer(Buffer): class FileBuffer(Buffer):
def __init__(self, env, result): def __init__(self, env, result):