[Erp5-report] r12196 - /erp5/trunk/products/ERP5/Document/

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Jan 22 14:02:05 CET 2007


Author: bartek
Date: Mon Jan 22 14:02:01 2007
New Revision: 12196

URL: http://svn.erp5.org?rev=12196&view=rev
Log:
reimplemented external status message as workflow variable

Modified:
    erp5/trunk/products/ERP5/Document/ExternalDocument.py
    erp5/trunk/products/ERP5/Document/ExternalWebPage.py

Modified: erp5/trunk/products/ERP5/Document/ExternalDocument.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/ExternalDocument.py?rev=12196&r1=12195&r2=12196&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/ExternalDocument.py (original)
+++ erp5/trunk/products/ERP5/Document/ExternalDocument.py Mon Jan 22 14:02:01 2007
@@ -127,20 +127,24 @@
       s,inf=self._spiderSource()
     except Exception,e:
       self.log(e,level=1)
-      self.setExternalProcessingStatusMessage("Tried on %s: %s" % (self._time(),str(e)))
+      msg = "Tried on %s: %s" % (self._time(),str(e))
+      portal_workflow.doActionFor(context, 'process', comment=msg)
       return False
     chars=len(s)
     if chars==0:
-      self.setExternalProcessingStatusMessage("Tried on %s: got empty string" % self._time())
+      msg = "Tried on %s: got empty string" % self._time() 
+      portal_workflow.doActionFor(context, 'process', comment=msg)
       return False
     try:
       s=self._processData(s,inf)
     except Exception,e:
       self.log(e,level=1)
-      self.setExternalProcessingStatusMessage("Spidered on %s, %i chars, but could not process; reason: %s" % (self._time(), chars, str(e)))
+      msg = "Spidered on %s, %i chars, but could not process; reason: %s" % (self._time(), chars, str(e))
+      portal_workflow.doActionFor(context, 'process', comment=msg)
       return False
     self.setTextContent(s)
-    self.setExternalProcessingStatusMessage("Spidered on %s, %i chars, recorded %i chars" % (self._time(), chars, len(s)))
+    msg = "Spidered on %s, %i chars, recorded %i chars" % (self._time(), chars, len(s))
+    portal_workflow.doActionFor(context, 'process', comment=msg)
     return True
 
   security.declareProtected(Permissions.View, 'getProtocolItemList')

Modified: erp5/trunk/products/ERP5/Document/ExternalWebPage.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/ExternalWebPage.py?rev=12196&r1=12195&r2=12196&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/ExternalWebPage.py (original)
+++ erp5/trunk/products/ERP5/Document/ExternalWebPage.py Mon Jan 22 14:02:01 2007
@@ -30,9 +30,12 @@
 from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
 from Products.ERP5.Document.File import stripHtml
 from Products.ERP5.Document.ExternalDocument import ExternalDocument, SpiderException
+from Products.CMFCore.utils import getToolByName
 
 import mimetypes, re, urllib
 from htmlentitydefs import name2codepoint
+
+portal_workflow = getToolByName('portal_workflow')
 
 rx=[]
 rx.append(re.compile('<!--.*?-->',re.DOTALL|re.MULTILINE)) # clear comments (sometimes JavaScript code in comments contains > chars)
@@ -202,7 +205,8 @@
     try:
       s=recode(s)
     except CanNotDecode:
-      self.setExternalProcessingStatusMessage("Spidered on %s, %i chars, but could not decode" % (self._time(), chars))
+      msg = "Spidered on %s, %i chars, but could not decode" % (self._time(), chars)
+      portal_workflow.doActionFor(context, 'process', comment=msg)
       return False
     s=stripHtml(s) # remove headers, doctype and the like
     s=clearHtml(s) # remove tags




More information about the Erp5-report mailing list