dabo Commit
Revision 1465
Date: 2005-10-18 16:02:06 -0700 (Tue, 18 Oct 2005)
Author: paul

Changed:
U   trunk/dabo/lib/reportWriter.py

Log:
Fixed report paragraphs to escape ampersands and less-than signs.


Diff:
Modified: trunk/dabo/lib/reportWriter.py
===================================================================
--- trunk/dabo/lib/reportWriter.py      2005-10-18 13:29:27 UTC (rev 1464)
+++ trunk/dabo/lib/reportWriter.py      2005-10-18 23:02:06 UTC (rev 1465)
@@ -433,6 +433,16 @@
                                                        # Blank line
                                                        p = platypus.Spacer(0, 
s.leading)
                                                else:
+                                                       def escapePara(para):
+                                                               words = 
para.split(" ")
+                                                               for idx, word 
in enumerate(words):
+                                                                       if "&" 
in word and ";" not in word:
+                                                                               
word = word.replace("&", "&")
+                                                                       if "<" 
in word and ">" not in word:
+                                                                               
word = word.replace("<", "&lt;")
+                                                                       
words[idx] = word
+                                                               return " 
".join(words)
+                                                       para = escapePara(para)
                                                        p = 
platypus.Paragraph(para, s)
                                                story.append(p)
                                                objNeededHeight += 
p.wrap(columnWidth-padLeft-padRight, None)[1]




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev

Reply via email to