# HG changeset patch # User casties # Date 1367598116 -7200 # Node ID ddd7e357e518d52ca99eeb041fe3f8071eb228c0 # Parent 06befe15f66f4866f483b9e989a9bddaad64c37d changed getPreprints to getPublicationsFromContext. returns simple list. diff -r 06befe15f66f -r ddd7e357e518 zopePubmanConnector.py --- a/zopePubmanConnector.py Fri May 03 14:30:07 2013 +0200 +++ b/zopePubmanConnector.py Fri May 03 18:21:56 2013 +0200 @@ -9,11 +9,7 @@ from Globals import package_home import httplib2 -import urlparse -import urllib -import re import xml.etree.ElementTree as ET -import json import logging @@ -229,8 +225,7 @@ return self.connectorString - - def getPreprintsFromContext(self,context,limit=None,publicationType=None): + def getPublicationsFromContext(self,context,limit=None,publicationType=None): """gibt alle publicationen des context, jeweils als tupel ("escidoc:id",METADATEN) METADATEN ist hierbei eine Map mit : @@ -241,13 +236,9 @@ "authors" --> [(NACHNAME,VORNAME]),..] "title"--> title "year" --> issued - - """ h = httplib2.Http(cacheFolder) - - if publicationType is None: cn = self.connectorString+"cqlQuery=escidoc.context.objid=%22"+context+"%22&" #cn = self.connectorString+"cqlQuery=escidoc.objid=%22"+"escidoc:643455"+"%22&" @@ -261,7 +252,6 @@ logging.debug(cn) resp, content = h.request(cn) - ET.register_namespace("dcterms", "http://purl.org/dc/terms/") @@ -299,13 +289,10 @@ # # Max-Planck-Institut für Wissenschaftsgeschichte : Preprint # 437 - - src= citation.find(srcpath) vol = src.find(volumepath) - #get link to fulltext # # @@ -331,11 +318,8 @@ else: link ="" - #Dieser Preprint versammelt eine Auswahl von Beiträgen zum Symposium zu Ehren von Hans-Jörg Rheinbergers 65. Geburtstag. Es fand am 24.1.2011 im Max-Planck-Institute für Wissenschaftsgeschichte statt und brachte Freunde, Studenten und Kollegen von Hans-Jörg Rheinberger zusammen. #In this preprint, a selection of contributions to the symposium in honor of Hans-Jörg Rheinberger’s 65th birthday is published. It took place on January 24, 2011 at the Max-Planck-Institute for the History of Science and assembled friends, students and colleagues of Hans-Jörg Rheinberger. - - abstracts = citation.findall(abstractpath) @@ -344,8 +328,6 @@ lang = abstract.get("{http://www.w3.org/XML/1998/namespace}lang") abstractTexts[lang]=abstract.text - - authorsTags = citation.findall(creatorpath) @@ -357,44 +339,31 @@ authors.append((fn,gn)) + titleTag = citation.find(titlepath) - titleTag = citation.find(titlepath) - - - if titleTag is not None: title = titleTag.text else: title="" - issuedTag = citation.find(issuedpath) - - if issuedTag is not None: issued = issuedTag.text else: issued="" - - - - ret.append((objId,{"citation":text.text,"volume":vol.text, - "link":link, - "abstracts":abstractTexts, - "authors":authors, - "title":title, - "year":issued})) - - def cmpret(x,y): #sort by preprint number - try: - return -cmp(int(x[2]),int(y[2])) - except: - return 0 - #return cmp(x[2],y[2]) - - ret.sort(cmpret) + item = {"id":objId, + "citation":text.text, + "volume":vol.text, + "link":link, + "abstracts":abstractTexts, + "authors":authors, + "title":title, + "year":issued} + + ret.append(item) + return ret @@ -412,7 +381,6 @@ newObj=ZopePubmanConnector(id,title,pubmanURL) self._setObject(id,newObj) - if RESPONSE is not None: RESPONSE.redirect('manage_main')