diff zopePubmanConnector.py @ 16:3e154b154b6f

timeouts
author dwinter
date Fri, 14 Jun 2013 12:27:01 +0200
parents ca3084877394
children 48c4a6f3b135
line wrap: on
line diff
--- a/zopePubmanConnector.py	Fri May 31 16:59:06 2013 +0200
+++ b/zopePubmanConnector.py	Fri Jun 14 12:27:01 2013 +0200
@@ -14,6 +14,8 @@
 import time
 import unicodedata
 
+TIMEOUT=10
+
 cacheFolder ="/var/tmp/.cacheWWW"
 
 ns = {'escidocMetadataProfile':"http://escidoc.mpg.de/metadataprofile/schema/0.1/",
@@ -69,7 +71,7 @@
         
     def getPublications(self,personID,limit=None,publicationType=None):
         """get all publications der personID"""
-        h = httplib2.Http(cacheFolder)
+        h = httplib2.Http(cacheFolder,timeout=TIMEOUT)
         
         
         
@@ -226,7 +228,7 @@
                 query="(%s)"%ctxquery
                 
         try:
-            h = httplib2.Http(cacheFolder)
+            h = httplib2.Http(cacheFolder,timeout=TIMEOUT)
             logging.debug("search: "+cn%query)
             resp, content = h.request(cn%query)
         except:
@@ -284,7 +286,7 @@
            
     
         escidocid=escidocid.lstrip().strip()
-        h = httplib2.Http(cacheFolder)
+        h = httplib2.Http(cacheFolder,timout=TIMEOUT)
         cn = self.connectorString+"cqlQuery=escidoc.objid=%s&"
         cn +="exportFormat=APA&outputFormat=snippet&language=all&sortKeys=escidoc.any-dates&sortOrder=descending"
       
@@ -387,7 +389,7 @@
         "title"--> title
         "year" --> issued
         """
-        h = httplib2.Http(cacheFolder)
+        h = httplib2.Http(cacheFolder,timeout=TIMEOUT)
         
         if publicationType is None:
             cn = self.connectorString+"cqlQuery=(escidoc.context.objid=%22"+context+"%22"