[Mpuls-commits] r3039 - in base/trunk: . mpulsweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Jun 18 18:29:32 CEST 2010


Author: bh
Date: 2010-06-18 18:29:31 +0200 (Fri, 18 Jun 2010)
New Revision: 3039

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/lib/renderer.py
Log:
* mpulsweb/lib/renderer.py (ViewRenderer._renderTextArea): Use
nl_to_br to convert newlines for HTML instead of having the code
inline.


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-06-18 16:20:41 UTC (rev 3038)
+++ base/trunk/ChangeLog	2010-06-18 16:29:31 UTC (rev 3039)
@@ -1,5 +1,11 @@
 2010-06-18  Bernhard Herzog  <bh at intevation.de>
 
+	* mpulsweb/lib/renderer.py (ViewRenderer._renderTextArea): Use
+	nl_to_br to convert newlines for HTML instead of having the code
+	inline.
+
+2010-06-18  Bernhard Herzog  <bh at intevation.de>
+
 	* mpulsweb/templates/auth/login.mako: Simplify escaping.
 
 2010-06-18  Bernhard Herzog  <bh at intevation.de>

Modified: base/trunk/mpulsweb/lib/renderer.py
===================================================================
--- base/trunk/mpulsweb/lib/renderer.py	2010-06-18 16:20:41 UTC (rev 3038)
+++ base/trunk/mpulsweb/lib/renderer.py	2010-06-18 16:29:31 UTC (rev 3039)
@@ -39,7 +39,7 @@
 from formed.instance.tree import RepeatInstanceContainerNode
 from formed.instance.backends.common import RuleEvalContext
 
-from mpulsweb.lib.helper.filters import NA
+from mpulsweb.lib.helper.filters import NA, nl_to_br
 from mpulsweb.lib.helpers import tag, url_for, dd_mm_YYYY as format_date
 
 
@@ -563,11 +563,8 @@
             out.append("</textarea>")
             out.append("<br>\n")
         else:
-            value = escape(value)
-            value = value.replace('\r\n', '<br>')
-            value = value.replace('\n', '<br>')
-            value = value.replace('\r', '<br>')
-            out.append('<p class="readonly">%s</p>' % (NA(value)))
+            out.append('<p class="readonly">%s</p>'
+                       % (NA(nl_to_br(escape(value)))))
         out.append(self._renderErrors(node))
         self.toTarget(Item("".join(out)), meta.getTarget())
 



More information about the Mpuls-commits mailing list