[Erp5-report] r40924 nicolas - /erp5/trunk/products/PortalTransforms/transforms/w3m_dump.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Nov 30 14:40:45 CET 2010


Author: nicolas
Date: Tue Nov 30 14:40:44 2010
New Revision: 40924

URL: http://svn.erp5.org?rev=40924&view=rev
Log:
Use subprocess backend to execute external tool.
It helps to read only stdout, not a mix with stderr.

Modified:
    erp5/trunk/products/PortalTransforms/transforms/w3m_dump.py

Modified: erp5/trunk/products/PortalTransforms/transforms/w3m_dump.py
URL: http://svn.erp5.org/erp5/trunk/products/PortalTransforms/transforms/w3m_dump.py?rev=40924&r1=40923&r2=40924&view=diff
==============================================================================
--- erp5/trunk/products/PortalTransforms/transforms/w3m_dump.py [utf8] (original)
+++ erp5/trunk/products/PortalTransforms/transforms/w3m_dump.py [utf8] Tue Nov 30 14:40:44 2010
@@ -1,6 +1,7 @@
+# -*- coding: utf-8 -*-
 ##############################################################################
 #
-# Copyright (c) 2008 Nexedi SARL and Contributors. All Rights Reserved.
+# Copyright (c) 2008-2010 Nexedi SA and Contributors. All Rights Reserved.
 #                    Rafael Monnerat <rafael at nexedi.com>
 #
 # WARNING: This program as such is intended to be used by professional
@@ -27,12 +28,13 @@
 ##############################################################################
 
 from Products.PortalTransforms.interfaces import itransform
-from Products.PortalTransforms.libtransforms.commandtransform import popentransform
+from Products.PortalTransforms.libtransforms.commandtransform import\
+                                                            subprocesstransform
 from zope.interface import implements
 
 # Conversor using w3m to replace lynx at PortalTransforms...
 
-class w3m_dump(popentransform):
+class w3m_dump(subprocesstransform):
   implements(itransform)
 
   __name__ = "w3m_dump"
@@ -44,15 +46,7 @@ class w3m_dump(popentransform):
   binaryName = "w3m"
   binaryArgs = "-dump -T text/html -o document_charset=utf-8 -o display_charset=utf-8 -o ignore_null_img_alt=0 "
   useStdin = True
-  
-  def getData(self, couterr):
-    lines = [ line for line in couterr.readlines()]
-    if len(lines) > 0:
-      # This prevent this message be showed
-      # -> "Can't open config directory (/root/.w3m)!"
-      if ".w3m" in lines[0]:
-        lines[0] = "".join(lines[0].split("!")[1:])
-    return "".join(lines)
+
 
 def register():
   return w3m_dump()



More information about the Erp5-report mailing list