diff --git a/bt5/erp5_knowledge_pad/ExtensionTemplateItem/GetRssDataAsDict.py b/bt5/erp5_knowledge_pad/ExtensionTemplateItem/GetRssDataAsDict.py index cce1bf255a0ce8e99e7d65e78c0c893baff2b033..dd67ea69a61f89bf1f27eb58ecada92f6e9d2e99 100644 --- a/bt5/erp5_knowledge_pad/ExtensionTemplateItem/GetRssDataAsDict.py +++ b/bt5/erp5_knowledge_pad/ExtensionTemplateItem/GetRssDataAsDict.py @@ -3,6 +3,7 @@ from urllib2 import HTTPPasswordMgrWithDefaultRealm, HTTPBasicAuthHandler, \ from xml.dom.minidom import parseString import md5 from HTMLParser import HTMLParser +import socket def getRssDataAsDict(url, username, password): passman = HTTPPasswordMgrWithDefaultRealm() @@ -11,7 +12,13 @@ def getRssDataAsDict(url, username, password): opener = build_opener(auth_handler) install_opener(opener) try: - file = urlopen(url) + default_timeout = socket.getdefaulttimeout() + socket.setdefaulttimeout(5.0) + try: + file = urlopen(url) + finally: + socket.setdefaulttimeout(default_timeout) + except IOError , e: return {'title': 'Connection problem, please retry later.'} except ValueError , e: diff --git a/bt5/erp5_knowledge_pad/bt/revision b/bt5/erp5_knowledge_pad/bt/revision index c047c4aba9bb7da73243f84e689c9c15c3bd2c6e..82cf079698a0f9d9ba57d0fac0a29786fe194bc0 100644 --- a/bt5/erp5_knowledge_pad/bt/revision +++ b/bt5/erp5_knowledge_pad/bt/revision @@ -1 +1 @@ -518 \ No newline at end of file +519 \ No newline at end of file