appy.pod: bugfix for https://bugs.launchpad.net/appy/+bug/778728 (function 'text').

This commit is contained in:
Gaetan Delannay 2011-06-17 02:11:34 +02:00
parent a20af9e28a
commit 344229e3a9

View file

@ -21,7 +21,7 @@ import zipfile, shutil, xml.sax, os, os.path, re, mimetypes, time
from UserDict import UserDict from UserDict import UserDict
import appy.pod, time import appy.pod, time, cgi
from appy.pod import PodError from appy.pod import PodError
from appy.shared import mimeTypesExts from appy.shared import mimeTypesExts
from appy.shared.xml_parser import XmlElement from appy.shared.xml_parser import XmlElement
@ -240,7 +240,7 @@ class Renderer:
def renderText(self, text, encoding='utf-8', stylesMapping={}): def renderText(self, text, encoding='utf-8', stylesMapping={}):
'''Method that can be used (under the name 'text') into a pod template '''Method that can be used (under the name 'text') into a pod template
for inserting a text containing carriage returns.''' for inserting a text containing carriage returns.'''
text = text.replace('\r\n', '<br/>').replace('\n', '<br/>') text = cgi.escape(text).replace('\r\n', '<br/>').replace('\n', '<br/>')
return self.renderXhtml(text, encoding, stylesMapping) return self.renderXhtml(text, encoding, stylesMapping)
def evalIfExpression(self, condition, ifTrue, ifFalse): def evalIfExpression(self, condition, ifTrue, ifFalse):