# HG changeset patch # User dwinter # Date 1367343929 -7200 # Node ID f845502cf73aeb30bbfba4280f9215b586c1b7fd # Parent 602b6e46b176637d37b62c916802ee7b3ba87a8f preprint methoden hinzugefuegt diff -r 602b6e46b176 -r f845502cf73a zopePubmanConnector.py --- a/zopePubmanConnector.py Tue Apr 30 18:34:18 2013 +0200 +++ b/zopePubmanConnector.py Tue Apr 30 19:45:29 2013 +0200 @@ -176,6 +176,8 @@ def getEntryFromPubman(self,escidocid): + """get one entry""" + escidocid=escidocid.lstrip().strip() h = httplib2.Http() cn = self.connectorString+"cqlQuery=escidoc.objid=%s&" @@ -184,7 +186,7 @@ resp, content = h.request(cn%escidocid) ET.register_namespace("dcterms", "http://purl.org/dc/terms/") logging.debug(cn%escidocid) - + root = ET.fromstring(content) @@ -200,6 +202,133 @@ def pubmanConnectorURL(self): return self.connectorString + + + + def getPreprintsFromContext(self,context,limit=None,publicationType=None): + """get all publications des context""" + h = httplib2.Http() + + + + if publicationType is None: + cn = self.connectorString+"cqlQuery=escidoc.context.objid=%22"+context+"%22&" + #cn = self.connectorString+"cqlQuery=escidoc.objid=%22"+"escidoc:643455"+"%22&" + else: + cn = self.connectorString+"cqlQuery=escidoc.context.objid=%22"+context+"%22" + cn +="%20and%20escidoc.publication.type=%22"+publicationType+"%22&" + + cn +="exportFormat=APA&outputFormat=snippet&language=all&sortKeys=escidoc.any-dates&sortOrder=descending" + if limit: + cn+="&maximumRecords=%s"%limit + + logging.debug(cn) + resp, content = h.request(cn) + + + ET.register_namespace("dcterms", "http://purl.org/dc/terms/") + + root = ET.fromstring(content) + + # + # Max-Planck-Institut für Wissenschaftsgeschichte : Preprint + # 437 + + + + src= citation.find(srcpath) + vol = src.find(volumepath) + + + #get link to fulltext + # + # + # 2013-04-29T09:00:01.100Z + # valid + # public + # pre-print + # P437.PDF + # application/pdf + # d0ccdc62d6707d934e60e9839ffe30bf + # MD5 + # + # + # + + src= citation.find(linkspath) + if src is not None: + + link=src.get("{http://www.w3.org/1999/xlink}href") + #logging.debug(src.attrib) + + 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) + + abstractTexts={} + for abstract in abstracts: + + lang = abstract.get("{http://www.w3.org/XML/1998/namespace}lang") + abstractTexts[lang]=abstract.text + + + #if abstractDE is not None: + # abstactDEtext = abstractDE.text + #else: + # abstactDEtext = "" + + # abstractEN = citation.find(abstractENpath) + # if abstractEN is not None: + # abstactENtext = abstractEN.text + # else: + # abstactENtext = "" + # + + ret.append((objId,text.text,vol.text,link,abstractTexts)) + + + 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) + return ret + + + def manage_addZopePubmanConnectorForm(self): """Form for external Links"""