[Checkins] SVN: z3c.rml/trunk/ - Upgraded to work with ReportLab 2.1 and lxml 1.3.6.

Stephan Richter srichter at cosmos.phy.tufts.edu
Sat Nov 10 15:58:34 EST 2007


Log message for revision 81730:
  - Upgraded to work with ReportLab 2.1 and lxml 1.3.6.
  
  - Fix sub-process tests for a pure egg setup.
  

Changed:
  U   z3c.rml/trunk/CHANGES.txt
  U   z3c.rml/trunk/setup.py
  U   z3c.rml/trunk/src/z3c/rml/attr.py
  U   z3c.rml/trunk/src/z3c/rml/rml2pdfscript.py

-=-
Modified: z3c.rml/trunk/CHANGES.txt
===================================================================
--- z3c.rml/trunk/CHANGES.txt	2007-11-10 19:27:08 UTC (rev 81729)
+++ z3c.rml/trunk/CHANGES.txt	2007-11-10 20:58:34 UTC (rev 81730)
@@ -2,15 +2,23 @@
 CHANGES
 =======
 
-0.7.1 (07/31/2007)
+0.7.2 (2007-11-10)
 ------------------
 
+- Upgraded to work with ReportLab 2.1 and lxml 1.3.6.
+
+- Fix sub-process tests for a pure egg setup.
+
+
+0.7.1 (2007-07-31)
+------------------
+
 - Bug: When the specified page size (within the ``pageInfo`` element) was a
   word or set thereof, the processing would fail. Thanks to Chris Zelenak for
   reporting the bug and providing a patch.
 
 
-0.7.0 (06/19/2007)
+0.7.0 (2007-06-19)
 ------------------
 
 - Feature: Added a Chinese PDF sample file to ``tests/expected`` under the
@@ -42,7 +50,7 @@
 - Bug: Handle Windows drive letters correctly. Report and fix by Yuan Hong.
 
 
-0.6.0 (06/19/2007)
+0.6.0 (2007-06-19)
 ------------------
 
 - Bug: Fixed setup.py to include all dependencies.
@@ -55,7 +63,7 @@
   good layout fixes that broke the image comparison.
 
 
-0.5.0 (04/01/2007)
+0.5.0 (2007-04-01)
 ------------------
 
 - Initial Release

Modified: z3c.rml/trunk/setup.py
===================================================================
--- z3c.rml/trunk/setup.py	2007-11-10 19:27:08 UTC (rev 81729)
+++ z3c.rml/trunk/setup.py	2007-11-10 20:58:34 UTC (rev 81730)
@@ -21,7 +21,7 @@
 
 setup (
     name='z3c.rml',
-    version='0.7.1',
+    version='0.7.2',
     author = "Stephan Richter and the Zope Community",
     author_email = "zope3-dev at zope.org",
     description = "An alternative implementation of RML",
@@ -41,15 +41,15 @@
         'Operating System :: OS Independent'],
     url = 'http://cheeseshop.python.org/pypi/z3c.rml',
     packages = find_packages('src'),
-    include_package_data = True,
     package_dir = {'':'src'},
     namespace_packages = ['z3c'],
-    zip_safe = False,
     extras_require = dict(
         test = ['zope.pagetemplate', 'zope.testing'],
         pagetemplate = ['zope.pagetemplate']
         ),
     install_requires = [
+        'lxml',
+        'pyPdf',
         # ReportLab does not seem to upload their packages to PyPI
         # 'reportlab',
         'setuptools',
@@ -61,6 +61,7 @@
             'dtd = z3c.rml.dtd:main',
             'reference = z3c.rml.reference:main'],
         },
-    dependency_links = ['http://download.zope.org/distribution']
+    include_package_data = True,
+    zip_safe = False,
     )
 

Modified: z3c.rml/trunk/src/z3c/rml/attr.py
===================================================================
--- z3c.rml/trunk/src/z3c/rml/attr.py	2007-11-10 19:27:08 UTC (rev 81729)
+++ z3c.rml/trunk/src/z3c/rml/attr.py	2007-11-10 20:58:34 UTC (rev 81730)
@@ -469,9 +469,10 @@
                     subElement, self.context)
                 substitute.process()
         # Now create the text
-        text = saxutils.escape(self.context.element.text or u'')
-        for child in self.context.element.getchildren():
-            text += etree.tounicode(child)
+        # ReportLab's paragraph parser does not like attributes from other
+        # namespaces; sigh. So we have to improvize.
+        text = etree.tounicode(self.context.element)
+        text = text[text.find('>')+1:text.rfind('<')]
         return text
 
 

Modified: z3c.rml/trunk/src/z3c/rml/rml2pdfscript.py
===================================================================
--- z3c.rml/trunk/src/z3c/rml/rml2pdfscript.py	2007-11-10 19:27:08 UTC (rev 81729)
+++ z3c.rml/trunk/src/z3c/rml/rml2pdfscript.py	2007-11-10 20:58:34 UTC (rev 81730)
@@ -16,7 +16,6 @@
 $Id: rml2pdf.py 74160 2007-04-15 22:04:24Z srichter $
 """
 __docformat__ = "reStructuredText"
-
 import subprocess
 import sys
 import os
@@ -27,13 +26,12 @@
 def excecuteSubProcess(xmlInputName, outputFileName, testing=None):
     # set the sys path given from the parent process
     sysPath = os.environ['Z3CRMLSYSPATH']
-    for p in sysPath.split(';'):
-        sys.path.insert(0, p)
+    sys.path[:] = sysPath.split(';')
 
     # now it come the ugly thing, but we need to hook our test changes into
     # our subprocess.
     if testing is not None:
-        
+
         # set some globals
         import z3c.rml.attr
         import z3c.rml.directive
@@ -71,9 +69,9 @@
     This method is much slower then the ``go`` method defined in rml2pdf.py
     because each PDF generation is done in a sub process. But this will make
     sure, that we do not run into problems. Note, the ReportLab lib is not
-    threadsafe. 
+    threadsafe.
 
-    Use this method from python and it will dispatch the pdf generation 
+    Use this method from python and it will dispatch the pdf generation
     to a subprocess.
 
     Note: this method does not take care on how much process will started.
@@ -88,13 +86,13 @@
     py = sys.executable
 
     # setup the cmd
-    program = [py, __file__, 'excecuteSubProcess', xmlInputName, outputFileName]
+    program = [__file__, 'excecuteSubProcess', xmlInputName, outputFileName]
     if testing is True:
         program.append('testing=1')
     program = " ".join(program)
 
-    # run the subprocess in the rml input file folder, this will make it easy 
-    # to include images. If this doesn't fit, feel free to add a additional 
+    # run the subprocess in the rml input file folder, this will make it easy
+    # to include images. If this doesn't fit, feel free to add a additional
     # home argument, and let this be the default, ri
     os.chdir(os.path.dirname(xmlInputName))
 
@@ -106,12 +104,12 @@
     except Exception, e:
         raise Exception("Subprocess error: %s" % e)
 
-    # Do we need improve the implementation and to kill subprocess which will 
+    # Do we need to improve the implementation and kill the subprocess which will
     # fail? ri
     stdout, stderr = p.communicate()
     error = stderr
     if error:
-        raise Exception("Subprocess error: %s" % error) 
+        raise Exception("Subprocess error: %s" % error)
 
 
 if __name__ == '__main__':



More information about the Checkins mailing list