[Erp5-report] r41723 jm - in /erp5/trunk/products/PortalTransforms: ./ libtransforms/ tests...

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Dec 23 17:36:40 CET 2010


Author: jm
Date: Thu Dec 23 17:36:40 2010
New Revision: 41723

URL: http://svn.erp5.org?rev=41723&view=rev
Log:
PortalTransforms: merge upstream 1.4.2-final

Drop [6704] ("Make header level and report level configurable per-instance")

Conflicts:
	HISTORY.txt
	transforms/html_to_text.py
	transforms/rest.py
	transforms/safe_html.py
	version.txt

Added:
    erp5/trunk/products/PortalTransforms/tests/test_doctests.py
Modified:
    erp5/trunk/products/PortalTransforms/HISTORY.txt
    erp5/trunk/products/PortalTransforms/chain.py
    erp5/trunk/products/PortalTransforms/libtransforms/utils.py
    erp5/trunk/products/PortalTransforms/tests/output/rest2.out
    erp5/trunk/products/PortalTransforms/tests/output/rest3.out
    erp5/trunk/products/PortalTransforms/tests/output/test_html_to_text.txt
    erp5/trunk/products/PortalTransforms/transforms/html_to_text.py
    erp5/trunk/products/PortalTransforms/transforms/lynx_dump.py
    erp5/trunk/products/PortalTransforms/transforms/office_com.py
    erp5/trunk/products/PortalTransforms/transforms/rest.py
    erp5/trunk/products/PortalTransforms/version.txt

Modified: erp5/trunk/products/PortalTransforms/HISTORY.txt
URL: http://svn.erp5.org/erp5/trunk/products/PortalTransforms/HISTORY.txt?rev=41723&r1=41722&r2=41723&view=diff
==============================================================================
--- erp5/trunk/products/PortalTransforms/HISTORY.txt [utf8] (original)
+++ erp5/trunk/products/PortalTransforms/HISTORY.txt [utf8] Thu Dec 23 17:36:40 2010
@@ -47,6 +47,30 @@
     transform tool will be copied and this transform will be removed
     from copied one.
 
+1.5.0-final - 2006-12-15
+========================
+
+  * note for release-managers: The version-bump to 1.5 was a bit early, but now 
+    as we have it, i keep it and next release number in the cycle needed for
+    Archetypes 1.4.2 (used for Plone 2.5.2) of PortalTransforms is then the 1.5
+    final.
+    We dont need increasing of release numbers because of Plone 3.0, 
+    Archetypes 1.5, ... if theres no change in the dependen product, like 
+    this one. 
+    [jensens]
+
+1.5.0-a1 - 2006-10-25
+=====================
+
+  * casting to int is evil without previous check of the type. so we assume as
+    in CMFPlone just zero for non-int-castable values.
+    [jensens]
+
+  * the values in the safe_html valid tag dictionary can become strings when
+    modifying them via the ZMI. Explicitly convert them to integers before
+    testing their value.
+    [wichert]
+
 1.4.1-final - 2006-09-08
 ========================
 

Modified: erp5/trunk/products/PortalTransforms/chain.py
URL: http://svn.erp5.org/erp5/trunk/products/PortalTransforms/chain.py?rev=41723&r1=41722&r2=41723&view=diff
==============================================================================
--- erp5/trunk/products/PortalTransforms/chain.py [utf8] (original)
+++ erp5/trunk/products/PortalTransforms/chain.py [utf8] Thu Dec 23 17:36:40 2010
@@ -88,6 +88,7 @@ class TransformsChain(Implicit, Item, Ro
     It follows the transform API so that a chain is itself a transform.
     """
 
+    module = 'N/A'
     meta_type = 'TransformsChain'
 
     meta_types = all_meta_types = ()
@@ -113,15 +114,6 @@ class TransformsChain(Implicit, Item, Ro
         self.output = 'application/octet-stream'
         self._chain = None
 
-    def __setstate__(self, state):
-        """ __setstate__ is called whenever the instance is loaded
-            from the ZODB, like when Zope is restarted.
-
-            We should rebuild the chain at this time
-        """
-        TransformsChain.inheritedAttribute('__setstate__')(self, state)
-        self._chain = None
-
     def _chain_init(self):
         """ build the transforms chain """
         tr_tool = getToolByName(self, 'portal_transforms')
@@ -209,7 +201,7 @@ class TransformsChain(Implicit, Item, Ro
         """ reload the module where the transformation class is defined """
         for tr in self.objectValues():
             tr.reload()
-
+        self._chain_init()
 
     # utilities #
 

Modified: erp5/trunk/products/PortalTransforms/libtransforms/utils.py
URL: http://svn.erp5.org/erp5/trunk/products/PortalTransforms/libtransforms/utils.py?rev=41723&r1=41722&r2=41723&view=diff
==============================================================================
--- erp5/trunk/products/PortalTransforms/libtransforms/utils.py [utf8] (original)
+++ erp5/trunk/products/PortalTransforms/libtransforms/utils.py [utf8] Thu Dec 23 17:36:40 2010
@@ -4,6 +4,11 @@ import sys
 from sgmllib import SGMLParser
 
 try:
+    # Need to be imported before win32api to avoid dll loading
+    # problems.
+    import pywintypes
+    import pythoncom
+
     import win32api
     WIN32 = True
 except ImportError:

Modified: erp5/trunk/products/PortalTransforms/tests/output/rest2.out
URL: http://svn.erp5.org/erp5/trunk/products/PortalTransforms/tests/output/rest2.out?rev=41723&r1=41722&r2=41723&view=diff
==============================================================================
--- erp5/trunk/products/PortalTransforms/tests/output/rest2.out [utf8] (original)
+++ erp5/trunk/products/PortalTransforms/tests/output/rest2.out [utf8] Thu Dec 23 17:36:40 2010
@@ -1,6 +1,6 @@
 <h2 class="title">Heading 1</h2>
 <p>Some text.</p>
-<div class="section" id="heading-2">
-<h3><a name="heading-2">Heading 2</a></h3>
+<div class="section">
+<h3><a id="heading-2" name="heading-2">Heading 2</a></h3>
 <p>Some text, bla ble bli blo blu. Yes, i know this is <a class="reference" href="http://www.example.com">Stupid</a>.</p>
 </div>

Modified: erp5/trunk/products/PortalTransforms/tests/output/rest3.out
URL: http://svn.erp5.org/erp5/trunk/products/PortalTransforms/tests/output/rest3.out?rev=41723&r1=41722&r2=41723&view=diff
==============================================================================
--- erp5/trunk/products/PortalTransforms/tests/output/rest3.out [utf8] (original)
+++ erp5/trunk/products/PortalTransforms/tests/output/rest3.out [utf8] Thu Dec 23 17:36:40 2010
@@ -1,11 +1,11 @@
 <h2 class="title">Title</h2>
 <h3 class="subtitle">Subtitle</h3>
 <p>This is a test document to make sure subtitle gets the right heading.</p>
-<div class="section" id="now-the-real-heading">
-<h3><a name="now-the-real-heading">Now the real heading</a></h3>
+<div class="section">
+<h3><a id="now-the-real-heading" name="now-the-real-heading">Now the real heading</a></h3>
 <p>The brown fox jumped over the lazy dog.</p>
-<div class="section" id="with-a-subheading">
-<h4><a name="with-a-subheading">With a subheading</a></h4>
+<div class="section">
+<h4><a id="with-a-subheading" name="with-a-subheading">With a subheading</a></h4>
 <p>Some text, bla ble bli blo blu. Yes, i know this is <a class="reference" href="http://www.example.com">Stupid</a>.</p>
 </div>
 </div>

Modified: erp5/trunk/products/PortalTransforms/tests/output/test_html_to_text.txt
URL: http://svn.erp5.org/erp5/trunk/products/PortalTransforms/tests/output/test_html_to_text.txt?rev=41723&r1=41722&r2=41723&view=diff
==============================================================================
--- erp5/trunk/products/PortalTransforms/tests/output/test_html_to_text.txt [utf8] (original)
+++ erp5/trunk/products/PortalTransforms/tests/output/test_html_to_text.txt [utf8] Thu Dec 23 17:36:40 2010
@@ -22,7 +22,7 @@ Contact:
 goodger&#64;users.sourceforge.net
 Date:
 2002-10-03
-Web site:http://docutils.sourceforge.net/
+Web site: http://docutils.sourceforge.net/
 
 
 
@@ -33,9 +33,9 @@ copying or usage.  The exceptions are:
 docutils/optik.py, copyright Gregory P. Ward, released under a
 BSD-style license (which can be found in the module's source code).
 docutils/roman.py, copyright by Mark Pilgrim, released under the
-Python 2.1.1 license.
+Python 2.1.1 license .
 test/difflib.py, copyright by the Python Software Foundation,
-released under the Python 2.2 license.  This file is included for
+released under the Python 2.2 license .  This file is included for
 compatibility with Python versions less than 2.2; if you have Python
 2.2 or higher, difflib.py is not needed and may be removed.  (It's
 only used to report test failures anyhow; it isn't installed
@@ -43,7 +43,7 @@ anywhere.  The included file is a pre-ge
 difflib.py module included in Python 2.2.)
 
  (Disclaimer: I am not a lawyer.)  Both the BSD license and the Python
-license are OSI-approved and GPL-compatible.  Although complicated
+license are OSI-approved and GPL-compatible .  Although complicated
 by multiple owners and lots of legalese, the Python license basically
 lets you copy, use, modify, and redistribute files as long as you keep
 the copyright attribution intact, note any changes you make, and don't

Added: erp5/trunk/products/PortalTransforms/tests/test_doctests.py
URL: http://svn.erp5.org/erp5/trunk/products/PortalTransforms/tests/test_doctests.py?rev=41723&view=auto
==============================================================================
--- erp5/trunk/products/PortalTransforms/tests/test_doctests.py (added)
+++ erp5/trunk/products/PortalTransforms/tests/test_doctests.py [utf8] Thu Dec 23 17:36:40 2010
@@ -0,0 +1,11 @@
+import unittest
+from zope.testing import doctestunit
+
+modules = (
+    'Products.PortalTransforms.transforms.rest',
+    )
+
+def test_suite():
+    return unittest.TestSuite(
+        [doctestunit.DocTestSuite(module=module) for module in modules]
+        )

Modified: erp5/trunk/products/PortalTransforms/transforms/html_to_text.py
URL: http://svn.erp5.org/erp5/trunk/products/PortalTransforms/transforms/html_to_text.py?rev=41723&r1=41722&r2=41723&view=diff
==============================================================================
--- erp5/trunk/products/PortalTransforms/transforms/html_to_text.py [utf8] (original)
+++ erp5/trunk/products/PortalTransforms/transforms/html_to_text.py [utf8] Thu Dec 23 17:36:40 2010
@@ -7,13 +7,13 @@ class html_to_text(retransform):
 def register():
     # XXX convert entites with htmlentitydefs.name2codepoint ?
     return html_to_text("html_to_text",
-                       ('<script [^>]>.*</script>(?im)', ''),
-                       ('<style [^>]>.*</style>(?im)', ''),
-                       ('<head [^>]>.*</head>(?im)', ''),
+                       ('<script [^>]>.*</script>(?im)', ' '),
+                       ('<style [^>]>.*</style>(?im)', ' '),
+                       ('<head [^>]>.*</head>(?im)', ' '),
                        
                        # added for ERP5, we want to transform <br/> in newlines
                        ('<br\s*/?>(?im)', '\n'),
 
-                       ('(?im)<(h[1-6r]|address|p|ul|ol|dl|pre|div|center|blockquote|form|isindex|table)(?=\W)[^>]*>', ' '),
-                       ('<[^>]*>(?i)(?m)', ''),
+                       ('(?im)</?(font|em|i|strong|b)(?=\W)[^>]*>', ''),
+                       ('<[^>]*>(?i)(?m)', ' '),
                        )

Modified: erp5/trunk/products/PortalTransforms/transforms/lynx_dump.py
URL: http://svn.erp5.org/erp5/trunk/products/PortalTransforms/transforms/lynx_dump.py?rev=41723&r1=41722&r2=41723&view=diff
==============================================================================
--- erp5/trunk/products/PortalTransforms/transforms/lynx_dump.py [utf8] (original)
+++ erp5/trunk/products/PortalTransforms/transforms/lynx_dump.py [utf8] Thu Dec 23 17:36:40 2010
@@ -18,12 +18,12 @@ class lynx_dump(popentransform):
 
     binaryName = "lynx"
     # XXX does -stdin work on windows?
-    binaryArgs = "-dump -crawl -stdin"
+    binaryArgs = "-dump -stdin"
     useStdin = True
     
     def getData(self, couterr):
         lines = [ line for line in couterr.readlines() ]
-        return ''.join(lines[3:])
+        return ''.join(lines)
 
 class old_lynx_dump(commandtransform):
     implements(itransform)

Modified: erp5/trunk/products/PortalTransforms/transforms/office_com.py
URL: http://svn.erp5.org/erp5/trunk/products/PortalTransforms/transforms/office_com.py?rev=41723&r1=41722&r2=41723&view=diff
==============================================================================
--- erp5/trunk/products/PortalTransforms/transforms/office_com.py [utf8] (original)
+++ erp5/trunk/products/PortalTransforms/transforms/office_com.py [utf8] Thu Dec 23 17:36:40 2010
@@ -1,11 +1,13 @@
+# Need to be imported first to avoid dll loading problems.
+import pywintypes
+import pythoncom
+
+import os.path
+
 import win32com, sys, string, win32api, traceback, re, tempfile, os
 import win32com.client
-# from win32com.test.util import CheckClean
-import pythoncom
 from win32com.client import gencache
 from win32com.client import constants, Dispatch
-from pywintypes import Unicode
-import os.path
 
 from Products.PortalTransforms.libtransforms.commandtransform import commandtransform
 from Products.PortalTransforms.libtransforms.utils import bodyfinder, scrubHTML

Modified: erp5/trunk/products/PortalTransforms/transforms/rest.py
URL: http://svn.erp5.org/erp5/trunk/products/PortalTransforms/transforms/rest.py?rev=41723&r1=41722&r2=41723&view=diff
==============================================================================
--- erp5/trunk/products/PortalTransforms/transforms/rest.py [utf8] (original)
+++ erp5/trunk/products/PortalTransforms/transforms/rest.py [utf8] Thu Dec 23 17:36:40 2010
@@ -4,6 +4,37 @@ import sys
 from zope.interface import implements
 
 class rest:
+    r"""Converts from reST to HTML.
+
+      >>> transform = rest()
+      >>> class D:
+      ...     def setData(self, data):
+      ...         self.value = data
+
+      >>> data = transform.convert('*hello world*', D())
+      >>> print data.value
+      <p><em>hello world</em></p>
+      <BLANKLINE>
+
+    We want the 'raw' and 'include' directives to be disabled by
+    default:
+
+      >>> try:
+      ...     transform.convert('.. raw:: html\n  :file: <isonum.txt>', D())
+      ... except NotImplementedError:
+      ...     print 'Good'
+      ... else:
+      ...     print 'Failure'
+      Good
+
+      >>> try:
+      ...     transform.convert('.. include:: <isonum.txt>', D())
+      ... except NotImplementedError:
+      ...     print 'Good'
+      ... else:
+      ...     print 'Failure'
+      Good
+    """
     implements(itransform)
 
     __name__ = "rest_to_html"

Modified: erp5/trunk/products/PortalTransforms/version.txt
URL: http://svn.erp5.org/erp5/trunk/products/PortalTransforms/version.txt?rev=41723&r1=41722&r2=41723&view=diff
==============================================================================
--- erp5/trunk/products/PortalTransforms/version.txt [utf8] (original)
+++ erp5/trunk/products/PortalTransforms/version.txt [utf8] Thu Dec 23 17:36:40 2010
@@ -1 +1 @@
-1.4.1-nexedi
+1.4.2-nexedi



More information about the Erp5-report mailing list