Mercurial > hg > ZopePubmanConnector
changeset 16:3e154b154b6f
timeouts
author | dwinter |
---|---|
date | Fri, 14 Jun 2013 12:27:01 +0200 |
parents | ca3084877394 |
children | 48c4a6f3b135 |
files | scripts/cleanPub.py zopePubmanConnector.py |
diffstat | 2 files changed, 31 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/cleanPub.py Fri Jun 14 12:27:01 2013 +0200 @@ -0,0 +1,25 @@ +''' +Created on 14.06.2013 + +@author: dwinter +''' + + +import web + +db = web.database(dbn='postgres', db='personalwww', user='dwinter',host="tuxserve03") + + +tab = db.select("pubmanbiblio_old") + +data =set() + +for res in tab: + if res.priority is not None: + data.add((res.key_main,res.escidocid,res.priority)) + + +for d in data: + db.insert("pubmanbiblio",key_main=d[0],escidocid=d[1],priority=d[2]) + +db.close() \ No newline at end of file
--- 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"