[Erp5-report] r35725 ivan - /erp5/trunk/products/ERP5/Tool/ContributionTool.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri May 28 14:43:45 CEST 2010
Author: ivan
Date: Fri May 28 14:43:31 2010
New Revision: 35725
URL: http://svn.erp5.org?rev=35725&view=rev
Log:
Extend API so we can control if exceptions are raises (in UI mode we need a way without catching exceptions in ZODB scripts to detect and inform user that there's a problem with his URL)
Modified:
erp5/trunk/products/ERP5/Tool/ContributionTool.py
Modified: erp5/trunk/products/ERP5/Tool/ContributionTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Tool/ContributionTool.py?rev=35725&r1=35724&r2=35725&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Tool/ContributionTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Tool/ContributionTool.py [utf8] Fri May 28 14:43:31 2010
@@ -615,7 +615,7 @@
content.setContentMd5(new_content_md5)
security.declareProtected(Permissions.AddPortalContent, 'newContentFromURL')
- def newContentFromURL(self, container_path=None, id=None, repeat=MAX_REPEAT, **kw):
+ def newContentFromURL(self, container_path=None, id=None, repeat=MAX_REPEAT, batch_mode=True, **kw):
"""
A wrapper method for newContent which provides extra safety
in case or errors (ie. download, access, conflict, etc.).
@@ -643,7 +643,7 @@
# If this is an index document, stop crawling if crawling_depth is 0
document.activate().crawlContent()
except urllib2.HTTPError, error:
- if repeat == 0:
+ if repeat == 0 and batch_mode:
# here we must call the extendBadURLList method,--NOT Implemented--
# which had to add this url to bad URL list, so next time we avoid
# crawling bad URL
@@ -653,7 +653,7 @@
container_path=container_path, id=id,
repeat=repeat - 1, **kw)
except urllib2.URLError, error:
- if repeat == 0:
+ if repeat == 0 and batch_mode:
# XXX - Call the extendBadURLList method, --NOT Implemented--
raise
print error.reason
More information about the Erp5-report
mailing list