1. Dinu Gherman
  2. reportlab


Andrew Robinson  committed b9af7f5

get rid of global paraparser

  • Participants
  • Parent commits fb8daea
  • Branches default

Comments (0)

Files changed (2)

File src/reportlab/platypus/paragraph.py

View file
                     but could be used for line spacing.
-#our one and only parser
-# XXXXX if the parser has any internal state using only one is probably a BAD idea!
 def _lineClean(L):
     return join(filter(truth,split(strip(L))))
     def __init__(self, text, style, bulletText = None, frags=None, caseSensitive=1, encoding='utf8'):
         self.caseSensitive = caseSensitive
         self.encoding = encoding
         self._setup(text, style, bulletText or getattr(style,'bulletText',None), frags, cleanBlockQuotedText)
     def __repr__(self):
         n = self.__class__.__name__
         L = [n+"("]
         return '\n'.join(L)
     def _setup(self, text, style, bulletText, frags, cleaner):
+        #This used to be a global parser to save overhead.
+        #In the interests of thread safety it is being instantiated per paragraph.
+        #On the next release, we'll replace with a cElementTree parser
+        _parser = ParaParser()
         if frags is None:
             text = cleaner(text)
             _parser.caseSensitive = self.caseSensitive

File src/reportlab/platypus/paraparser.py

View file
     check_text('''Here comes <font face="Helvetica" size="14pt">Helvetica 14</font> with <Strong>strong</Strong> <em>emphasis</em>.''')
     check_text('''Here comes <font face="Courier" size="3cm">Courier 3cm</font> and normal again.''')
     check_text('''Before the break <br/>the middle line <br/> and the last line.''')
-    check_text('''This should be an inline image <img src='../docs/images/testimg.gif'/>!''')
+    check_text('''This should be an inline image <img src='../../../docs/images/testimg.gif'/>!''')
     check_text('''aaa&nbsp;bbbb <u>underline&#32;</u> cccc''')