Commit 4995cde0 authored by Bartek Górny's avatar Bartek Górny

pass on urlinfo object, so that processData can make some decisions

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10486 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5f594d3d
...@@ -101,10 +101,11 @@ class ExternalDocument(DMSFile): ...@@ -101,10 +101,11 @@ class ExternalDocument(DMSFile):
op=Opener() op=Opener()
f=op.open(self.getQualifiedUrl()) f=op.open(self.getQualifiedUrl())
s=f.read() s=f.read()
return s inf=f.info()
return s, inf
security.declarePrivate('_processData') security.declarePrivate('_processData')
def _processData(self,s): def _processData(self,s, inf):
raise Exception('this should be implemented in subclass') raise Exception('this should be implemented in subclass')
security.declareProtected(Permissions.ModifyPortalContent,'resetTopObject') security.declareProtected(Permissions.ModifyPortalContent,'resetTopObject')
...@@ -124,7 +125,7 @@ class ExternalDocument(DMSFile): ...@@ -124,7 +125,7 @@ class ExternalDocument(DMSFile):
returned value tells us if it succeeded or failed returned value tells us if it succeeded or failed
""" """
try: try:
s=self._spiderSource() s,inf=self._spiderSource()
except Exception,e: except Exception,e:
self.log(e,level=1) self.log(e,level=1)
self.setStatusMessage("Tried on %s: %s" % (self._time(),str(e))) self.setStatusMessage("Tried on %s: %s" % (self._time(),str(e)))
...@@ -134,7 +135,7 @@ class ExternalDocument(DMSFile): ...@@ -134,7 +135,7 @@ class ExternalDocument(DMSFile):
self.setStatusMessage("Tried on %s: got empty string" % self._time()) self.setStatusMessage("Tried on %s: got empty string" % self._time())
return False return False
try: try:
s=self._processData(s) s=self._processData(s,inf)
except Exception,e: except Exception,e:
self.log(e,level=1) self.log(e,level=1)
self.setStatusMessage("Spidered on %s, %i chars, but could not process; reason: %s" % (self._time(), chars, str(e))) self.setStatusMessage("Spidered on %s, %i chars, but could not process; reason: %s" % (self._time(), chars, str(e)))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment