Mercurial > hg > ZopePubmanConnector
annotate zopePubmanConnector.py @ 18:da890cb0fd04
shows also context if wanted in getEntryFromPubman
| author | dwinter |
|---|---|
| date | Wed, 26 Jun 2013 16:02:02 +0200 |
| parents | 48c4a6f3b135 |
| children | 38ff05179d71 |
| rev | line source |
|---|---|
| 0 | 1 # -*- coding: utf-8 -*- |
| 2 | |
| 3 #Verbindet Zope mit pubman. | |
| 4 | |
| 5 | |
| 6 from OFS.SimpleItem import SimpleItem | |
| 7 from Products.PageTemplates.PageTemplateFile import PageTemplateFile | |
| 8 import os.path | |
| 9 | |
| 10 from Globals import package_home | |
| 11 import httplib2 | |
| 12 import xml.etree.ElementTree as ET | |
| 1 | 13 import logging |
| 9 | 14 import time |
| 10 | 15 import unicodedata |
| 6 | 16 |
| 16 | 17 TIMEOUT=10 |
| 18 | |
| 6 | 19 cacheFolder ="/var/tmp/.cacheWWW" |
| 20 | |
| 14 | 21 ns = {'escidocMetadataProfile':"http://escidoc.mpg.de/metadataprofile/schema/0.1/", |
| 22 'escidocMetadataRecords':"http://www.escidoc.de/schemas/metadatarecords/0.4", | |
| 23 'dc':'http://purl.org/dc/elements/1.1/', | |
| 24 'escidocComponents':'http://www.escidoc.de/schemas/components/0.8', | |
| 18 | 25 'escidocItem':'http://www.escidoc.de/schemas/item/0.8', |
| 26 'srel':'http://escidoc.de/core/01/structural-relations/', | |
| 14 | 27 } |
| 28 | |
| 29 | |
| 30 | |
| 0 | 31 def zptFile(self, path, orphaned=False): |
| 32 """returns a page template file from the product""" | |
| 33 if orphaned: | |
| 34 # unusual case | |
| 35 pt=PageTemplateFile(os.path.join(package_home(globals()), path)) | |
| 36 else: | |
| 37 | |
| 38 pt=PageTemplateFile(os.path.join(package_home(globals()), path)).__of__(self) | |
| 39 return pt | |
| 40 | |
| 41 class ZopePubmanConnector(SimpleItem): | |
| 42 | |
| 43 | |
| 44 connectorString="http://pubman.mpiwg-berlin.mpg.de/search/SearchAndExport?" | |
| 45 | |
| 46 | |
| 47 meta_type="ZopePubmanConnector" | |
| 48 | |
| 49 manage_options= ({'label':'Main Config','action': 'changeMain'},) + SimpleItem.manage_options | |
| 50 | |
| 51 def __init__(self,id,title,pubmanURL): | |
| 52 self.id=id | |
| 53 self.title=title | |
| 54 self.pubmanURL=pubmanURL #URL einer pubman instance bzw. einer collection, falls nicht die default collection benutzt werden soll | |
| 55 | |
| 56 | |
| 57 | |
| 58 def changeMain(self,pubmanURL=None,title=None,REQUEST=None,RESPONSE=None): | |
| 59 """change main settings""" | |
| 60 if pubmanURL: | |
| 61 self.pubmanURL=pubmanURL | |
| 62 self.title=title | |
| 63 | |
| 64 if RESPONSE is not None: | |
| 65 RESPONSE.redirect('manage_main') | |
| 66 | |
| 67 | |
| 68 else: | |
| 69 pt=zptFile(self, 'zpt/ChangeZopePubmanConnector.zpt') | |
| 70 return pt() | |
| 71 | |
| 72 | |
| 2 | 73 def getPublications(self,personID,limit=None,publicationType=None): |
| 0 | 74 """get all publications der personID""" |
| 16 | 75 h = httplib2.Http(cacheFolder,timeout=TIMEOUT) |
| 1 | 76 |
| 77 | |
| 2 | 78 |
| 79 if publicationType is None: | |
| 11 | 80 # cn = self.connectorString+"cqlQuery=escidoc.any-identifier=%22"+personID+"%22&" |
| 81 cn = self.connectorString+"cqlQuery=escidoc.publication.creator.person.identifier=%22"+personID+"%22&" | |
| 2 | 82 else: |
| 11 | 83 #cn = self.connectorString+"cqlQuery=escidoc.any-identifier=%22"+personID+"%22" |
|
13
43849c9cc08b
Incomplete - # 74: More Link auf den pers?nlichne Homepages
dwinter
parents:
12
diff
changeset
|
84 cn = self.connectorString+"cqlQuery=%28escidoc.publication.creator.person.identifier=%22"+personID+"%22%29" |
|
43849c9cc08b
Incomplete - # 74: More Link auf den pers?nlichne Homepages
dwinter
parents:
12
diff
changeset
|
85 cn +="%20and%28%20escidoc.publication.type=%22"+publicationType+"%22%29&" |
| 2 | 86 |
| 87 cn +="exportFormat=APA&outputFormat=snippet&language=all&sortKeys=escidoc.any-dates&sortOrder=descending" | |
| 88 if limit: | |
| 89 cn+="&maximumRecords=%s"%limit | |
| 1 | 90 |
| 2 | 91 logging.debug(cn) |
| 92 resp, content = h.request(cn) | |
| 93 | |
| 3 | 94 |
| 2 | 95 |
| 0 | 96 ET.register_namespace("dcterms", "http://purl.org/dc/terms/") |
| 97 | |
| 98 root = ET.fromstring(content) | |
| 99 | |
| 2 | 100 #<escidocItem:item objid="escidoc:630782" |
| 101 | |
| 0 | 102 citationxpath=".//{http://purl.org/dc/terms/}bibliographicCitation" |
| 103 | |
| 2 | 104 objxpath=".//{http://www.escidoc.de/schemas/item/0.8}item" |
| 14 | 105 |
| 106 | |
| 107 | |
| 2 | 108 citations=root.findall(objxpath) |
| 14 | 109 logging.debug(len(citations)) |
| 0 | 110 ret=[] |
| 111 for citation in citations: | |
| 2 | 112 objId = citation.get('objid') |
| 14 | 113 |
| 2 | 114 text = citation.find(citationxpath) |
| 115 | |
| 14 | 116 |
| 117 | |
| 118 | |
| 119 | |
| 120 idTermPath =""".//escidocMetadataRecords:md-records/escidocMetadataRecords:md-record/escidocMetadataProfile:publication/dc:identifier""" | |
| 121 #idTermPath =".//{http://purl.org/dc/elements/1.1/}identifier" | |
| 122 | |
| 123 idterms = citation.findall(idTermPath,ns) | |
| 124 | |
| 125 linksIdentifier=[] | |
| 126 linksLocator=[] | |
| 127 | |
| 128 | |
| 129 bookID = None | |
| 130 | |
| 131 | |
| 132 for idterm in idterms: | |
| 133 if idterm.get("{http://www.w3.org/2001/XMLSchema-instance}type",'') in ['eterms:OTHER','eidt:OTHER']: ##suche nach bookID | |
| 134 logging.debug("zopePubmanConnector: %s"%idterm.text) | |
| 135 checkID =idterm.text.lstrip().rstrip() | |
| 136 if checkID.startswith("MPIWG-Book:"): | |
| 137 bookID = checkID | |
| 138 break | |
| 139 elif idterm.get("{http://www.w3.org/2001/XMLSchema-instance}type",'') in ['eterms:URI','eidt:URI']: | |
| 140 linksIdentifier.append(idterm.text.lstrip().rstrip()) | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 componentsPath =""".//escidocComponents:components[1]""" | |
| 146 | |
| 147 components=citation.findall(componentsPath,ns); | |
| 148 | |
| 149 for component in components: | |
| 150 cnt = component.find(".//escidocComponents:content",ns) | |
| 151 if cnt is not None: | |
| 152 link="" | |
| 153 title="" | |
| 154 type="" | |
| 155 for name,value in cnt.items(): | |
| 156 if name.endswith("href"): | |
| 157 link=value | |
| 158 elif name.endswith("title"): | |
| 159 title=value | |
| 160 elif name.endswith("storage"): | |
| 161 type=value | |
| 162 | |
| 163 linksLocator.append((title,link,type)) | |
| 164 | |
| 165 | |
| 166 | |
| 167 | |
| 168 ret.append((objId,text.text,bookID,linksIdentifier,linksLocator)) | |
| 0 | 169 |
| 170 | |
| 171 | |
| 172 return ret | |
| 173 | |
| 2 | 174 |
| 5 | 175 def search(self,values={},exact=False,limit=None,contexts=None): |
| 2 | 176 """search pubman |
| 177 @values map mit field->value | |
| 178 @return map mit escidocId -> XML-formatted snippeds | |
| 179 """ | |
| 180 | |
| 181 fieldToEscidoc={"title":"escidoc.any-title", | |
| 182 "author":"escidoc.publication.any.publication-creator-names", | |
| 10 | 183 "any":"escidoc.metadata"} |
| 2 | 184 |
| 185 | |
| 186 cn = self.connectorString+"cqlQuery=%s&" | |
| 187 cn +="exportFormat=APA&outputFormat=snippet&language=all&sortKeys=escidoc.any-dates&sortOrder=descending" | |
| 188 | |
| 5 | 189 if limit: |
| 190 cn+="&maximumRecords=%s"%limit | |
| 2 | 191 |
| 192 querys = [] | |
| 193 for field in values.keys(): | |
| 194 | |
| 195 searchField = fieldToEscidoc.get(field,None) | |
| 196 if searchField is None: | |
| 197 logging.debug("search, don't know field: %s"%field) | |
| 198 continue | |
| 199 | |
| 200 value = values[field] | |
| 10 | 201 try: |
| 202 value=unicodedata.normalize('NFKD', value).encode('ASCII', 'ignore') | |
| 203 except: | |
| 204 value=unicodedata.normalize('NFKD', value.decode('utf-8')).encode('ASCII', 'ignore') | |
| 2 | 205 if value == '': |
| 206 continue | |
| 207 logging.debug("%s=%s"%(field,value)) | |
| 208 if not exact: | |
| 209 value=value+"*" | |
| 210 | |
| 211 querys.append("%s=%%22%s%%22"%(searchField,value)) | |
| 212 | |
| 10 | 213 query="%20AND%20".join(querys) |
| 5 | 214 |
| 215 if contexts: # einscbraenken auf contexte | |
| 216 | |
| 217 if isinstance(contexts, str): | |
| 218 contexts=[contexts] | |
| 219 | |
| 220 ctxquerys=[] | |
| 221 for context in contexts: | |
| 222 ctxquerys.append("escidoc.context.objid=%%22%s%%22"%(context)) | |
| 223 | |
| 10 | 224 ctxquery="%20OR%20".join(ctxquerys) |
| 5 | 225 |
| 226 if query!="": | |
| 10 | 227 query=query+"AND%%20(%s)"%ctxquery |
| 5 | 228 else: |
| 229 query="(%s)"%ctxquery | |
| 230 | |
| 12 | 231 try: |
| 16 | 232 h = httplib2.Http(cacheFolder,timeout=TIMEOUT) |
| 12 | 233 logging.debug("search: "+cn%query) |
| 234 resp, content = h.request(cn%query) | |
| 235 except: | |
| 236 logging.error("Unable to get data from PubMan!") | |
| 237 return {} | |
| 2 | 238 |
| 239 ET.register_namespace("dcterms", "http://purl.org/dc/terms/") | |
| 240 | |
| 3 | 241 try: |
| 242 root = ET.fromstring(content) | |
| 243 except: | |
| 244 logging.error("Couldn't parse content of:%s"%(cn%query)) | |
| 245 return {} | |
| 2 | 246 #<escidocItem:item objid="escidoc:630782" |
| 247 | |
| 248 citationxpath=".//{http://purl.org/dc/terms/}bibliographicCitation" | |
| 249 | |
| 250 objxpath=".//{http://www.escidoc.de/schemas/item/0.8}item" | |
| 251 citations=root.findall(objxpath) | |
| 252 | |
| 253 ret={} | |
| 254 for citation in citations: | |
| 255 objId = citation.get('objid') | |
| 256 text = citation.find(citationxpath) | |
| 257 ret[objId]=text.text | |
| 258 | |
| 259 return ret | |
| 260 | |
| 11 | 261 |
| 262 def getEntriesFromPubman(self,escidocids): | |
| 2 | 263 |
| 11 | 264 doctypes={} |
| 265 for escidocid in escidocids: | |
| 266 | |
| 15 | 267 txt, type, bookID,linksIdentifier,linksLocator = self.getEntryFromPubman(escidocid.escidocid, True) |
| 11 | 268 |
| 269 if not doctypes.has_key(type): | |
| 270 doctypes[type]=[] | |
| 15 | 271 |
| 272 entry={} | |
| 273 entry['citation']= txt | |
| 274 entry['escidocId']= escidocid.escidocid | |
| 275 entry['bookId']=bookID | |
| 276 entry['linksIdentifier']=linksIdentifier | |
| 277 entry['linksLocator']=linksIdentifier | |
| 278 doctypes[type].append(entry) | |
| 11 | 279 |
| 280 | |
| 281 return doctypes | |
| 282 | |
| 283 | |
| 18 | 284 def getEntryFromPubman(self,escidocid,extendedData=None,withContext=False): |
| 4 | 285 """get one entry""" |
| 286 | |
| 14 | 287 |
| 288 | |
| 3 | 289 escidocid=escidocid.lstrip().strip() |
| 17 | 290 h = httplib2.Http(cacheFolder,timeout=TIMEOUT) |
| 2 | 291 cn = self.connectorString+"cqlQuery=escidoc.objid=%s&" |
| 292 cn +="exportFormat=APA&outputFormat=snippet&language=all&sortKeys=escidoc.any-dates&sortOrder=descending" | |
| 293 | |
| 294 resp, content = h.request(cn%escidocid) | |
| 295 ET.register_namespace("dcterms", "http://purl.org/dc/terms/") | |
| 3 | 296 logging.debug(cn%escidocid) |
| 4 | 297 |
| 18 | 298 try: |
| 299 root = ET.fromstring(content) | |
| 300 except: | |
| 301 logging.error("zopePubmanConnector: cannot parse") | |
| 302 logging.error(content) | |
| 303 return "",'' | |
| 2 | 304 |
| 305 citationxpath=".//{http://purl.org/dc/terms/}bibliographicCitation" | |
| 306 | |
| 14 | 307 itempath = ".//escidocItem:item" |
| 17 | 308 |
| 14 | 309 |
| 310 item = root.find(itempath,ns) #get item | |
| 311 | |
| 17 | 312 if item is None: |
| 313 logging.error("pubman connector: cannot find %s"%escidocid) | |
| 314 return escidocid,"","","","" | |
| 315 | |
| 14 | 316 citation=item.find(citationxpath,ns) |
| 317 | |
| 318 | |
| 319 if citation is not None and extendedData is not None: | |
| 320 | |
| 321 linksIdentifier=[] | |
| 322 linksLocator=[] | |
| 323 | |
| 2 | 324 |
| 11 | 325 |
| 14 | 326 #get identifier |
| 327 idTermPath =""".//escidocMetadataRecords:md-records/escidocMetadataRecords:md-record/escidocMetadataProfile:publication/dc:identifier""" | |
| 328 #idTermPath =".//{http://purl.org/dc/elements/1.1/}identifier" | |
| 329 | |
| 330 idterms = item.findall(idTermPath,ns) | |
| 331 | |
| 332 bookID = None | |
| 333 logging.debug("zopePubmanConnector: %s"%idterms) | |
| 334 for idterm in idterms: | |
| 335 | |
| 336 if idterm.get("{http://www.w3.org/2001/XMLSchema-instance}type",'') in ['eterms:OTHER','eidt:OTHER']: ##suche nach bookID | |
| 337 logging.debug("zopePubmanConnector: %s"%idterm.text) | |
| 338 checkID =idterm.text.lstrip().rstrip() | |
| 339 if checkID.startswith("MPIWG-Book:"): | |
| 340 bookID = checkID | |
| 341 break | |
| 342 elif idterm.get("{http://www.w3.org/2001/XMLSchema-instance}type",'') in ['eterms:URI','eidt:URI']: | |
| 343 linksIdentifier.append(idterm.text.lstrip().rstrip()) | |
| 344 | |
| 345 | |
| 346 #get files and locators | |
| 347 componentsPath =""".//escidocComponents:components[1]""" | |
| 348 | |
| 349 components=item.findall(componentsPath,ns); | |
| 350 | |
| 351 for component in components: | |
| 352 cnt = component.find(".//escidocComponents:content",ns) | |
| 353 if cnt is not None: | |
| 354 link="" | |
| 355 title="" | |
| 356 type="" | |
| 357 for name,value in cnt.items(): | |
| 358 if name.endswith("href"): | |
| 359 link=value | |
| 360 elif name.endswith("title"): | |
| 361 title=value | |
| 362 elif name.endswith("storage"): | |
| 363 type=value | |
| 364 | |
| 365 linksLocator.append((title,link,type)) | |
| 366 | |
| 367 | |
| 368 | |
| 369 | |
| 370 | |
| 371 | |
| 372 | |
| 373 | |
| 374 | |
| 11 | 375 path = ".//escidocMetadataRecords:md-records/escidocMetadataRecords:md-record/escidocMetadataProfile:publication" |
| 14 | 376 publicationTag= item.find(path,ns); |
| 377 | |
| 378 return citation.text,publicationTag.get('type'),bookID,linksIdentifier,linksLocator | |
| 11 | 379 |
| 18 | 380 |
| 381 if citation is not None and withContext: | |
| 382 ctxPath=".//escidocItem:properties/srel:context" | |
| 383 ctx = item.find(ctxPath,ns) | |
| 384 | |
| 385 return citation.text,ctx.get('objid') | |
| 386 | |
| 2 | 387 if citation is not None: |
| 388 | |
| 389 return citation.text | |
| 11 | 390 |
| 18 | 391 |
| 392 | |
| 393 | |
| 11 | 394 return "",'' |
| 2 | 395 |
| 0 | 396 def pubmanConnectorURL(self): |
| 397 return self.connectorString | |
| 4 | 398 |
| 399 | |
| 10 | 400 def getPublicationsFromContext(self,context,limit=None,publicationType=None,search=None): |
| 7 | 401 """gibt alle publicationen des context, jeweils als tupel ("escidoc:id",METADATEN) |
| 402 | |
| 403 METADATEN ist hierbei eine Map mit : | |
| 404 "citation" --> citation in der APA formatierung | |
| 405 "volume" --> volume | |
| 406 "link" --> dowloadlink | |
| 407 "abstracts" --> map mit deu/eng für den abstrakt | |
| 408 "authors" --> [(NACHNAME,VORNAME]),..] | |
| 409 "title"--> title | |
| 410 "year" --> issued | |
| 411 """ | |
| 16 | 412 h = httplib2.Http(cacheFolder,timeout=TIMEOUT) |
| 4 | 413 |
| 414 if publicationType is None: | |
| 10 | 415 cn = self.connectorString+"cqlQuery=(escidoc.context.objid=%22"+context+"%22" |
| 4 | 416 #cn = self.connectorString+"cqlQuery=escidoc.objid=%22"+"escidoc:643455"+"%22&" |
| 417 else: | |
| 10 | 418 cn = self.connectorString+"cqlQuery=(escidoc.context.objid=%22"+context+"%22" |
| 419 cn +="%20and%20escidoc.publication.type=%22"+publicationType+"%22" | |
| 4 | 420 |
| 10 | 421 if search is not None and search != "": |
| 422 try: | |
| 423 search = unicodedata.normalize('NFKD', search).encode('ASCII', 'ignore') | |
| 424 except: | |
| 425 search = unicodedata.normalize('NFKD', search.decode('utf-8')).encode('ASCII', 'ignore') | |
| 426 cn+="%20and%20escidoc.metadata="+search+"" | |
| 427 | |
| 428 | |
| 429 cn +=")&exportFormat=APA&outputFormat=snippet&language=all&sortKeys=escidoc.any-dates&sortOrder=descending" | |
| 4 | 430 if limit: |
| 431 cn+="&maximumRecords=%s"%limit | |
| 432 | |
| 9 | 433 startTime = time.time() |
| 12 | 434 try: |
| 435 logging.debug("getPublicationsFromContext: getting %s"%cn) | |
| 436 resp, content = h.request(cn) | |
| 437 logging.debug("getPublicationsFromContext: got data in %ss"%(time.time()-startTime)) | |
| 4 | 438 |
| 12 | 439 ET.register_namespace("dcterms", "http://purl.org/dc/terms/") |
| 4 | 440 |
| 12 | 441 root = ET.fromstring(content) |
| 442 | |
| 443 except Exception, e: | |
| 444 logging.error("Unable to read and parse data! %s"%e) | |
| 445 return [] | |
| 446 | |
| 4 | 447 #<escidocItem:item objid="escidoc:630782" |
| 448 | |
| 449 citationxpath=".//{http://purl.org/dc/terms/}bibliographicCitation" | |
| 450 abstractpath=".//{http://purl.org/dc/terms/}abstract" | |
| 6 | 451 issuedpath=".//{http://purl.org/dc/terms/}issued" |
| 452 | |
| 453 creatorpath=".//{http://escidoc.mpg.de/metadataprofile/schema/0.1/publication}creator/{http://escidoc.mpg.de/metadataprofile/schema/0.1/types}person" | |
| 454 familyNamepath=".//{http://escidoc.mpg.de/metadataprofile/schema/0.1/types}family-name" | |
| 455 givenNamepath=".//{http://escidoc.mpg.de/metadataprofile/schema/0.1/types}given-name" | |
| 456 | |
| 457 | |
| 458 titlepath=".//{http://purl.org/dc/elements/1.1/}title" | |
| 4 | 459 |
| 460 objxpath=".//{http://www.escidoc.de/schemas/item/0.8}item" | |
| 461 srcpath=".//{http://escidoc.mpg.de/metadataprofile/schema/0.1/publication}source" | |
| 462 volumepath=".//{http://escidoc.mpg.de/metadataprofile/schema/0.1/types}volume" | |
| 463 | |
| 464 #linkspath=""".//{http://www.escidoc.de/schemas/components/0.8}component/{http://www.escidoc.de/schemas/components/0.8}content[@storage="internal-managed"]""" | |
| 465 linkspath=""".//{http://www.escidoc.de/schemas/components/0.8}component/{http://www.escidoc.de/schemas/components/0.8}content[@storage="external-url"]""" | |
| 466 #linkspath=".//{http://www.escidoc.de/schemas/components/0.8}component/{http://www.escidoc.de/schemas/components/0.8}content" | |
| 467 citations=root.findall(objxpath) | |
| 468 | |
| 469 ret=[] | |
| 470 for citation in citations: | |
| 471 objId = citation.get('objid') | |
| 472 | |
| 473 text = citation.find(citationxpath) | |
| 474 | |
| 475 #Get volume = preprintID | |
| 476 # <publication:source type="series"> | |
| 477 # <dc:title>Max-Planck-Institut für Wissenschaftsgeschichte : Preprint</dc:title> | |
| 478 # <escidoc:volume>437</escidoc:volume> | |
| 479 | |
| 480 src= citation.find(srcpath) | |
| 481 vol = src.find(volumepath) | |
| 482 | |
| 483 #get link to fulltext | |
| 484 #<escidocComponents:component objid="escidoc:644183"> | |
| 485 #<escidocComponents:properties> | |
| 486 # <prop:creation-date>2013-04-29T09:00:01.100Z</prop:creation-date> | |
| 487 # <prop:valid-status>valid</prop:valid-status> | |
| 488 # <prop:visibility>public</prop:visibility> | |
| 489 # <prop:content-category>pre-print</prop:content-category> | |
| 490 # <prop:file-name>P437.PDF</prop:file-name> | |
| 491 # <prop:mime-type>application/pdf</prop:mime-type> | |
| 492 # <prop:checksum>d0ccdc62d6707d934e60e9839ffe30bf</prop:checksum> | |
| 493 # <prop:checksum-algorithm>MD5</prop:checksum-algorithm> | |
| 494 #</escidocComponents:properties> | |
| 495 #<escidocComponents:content xlink:type="simple" xlink:title="P437.PDF" storage="internal-managed" | |
| 496 # xlink:href="http://pubman.mpiwg-berlin.mpg.de/pubman/item/escidoc:643686:3/component/escidoc:644183/P437.PDF"/> | |
| 497 # | |
| 498 | |
| 499 src= citation.find(linkspath) | |
| 500 if src is not None: | |
| 501 | |
| 502 link=src.get("{http://www.w3.org/1999/xlink}href") | |
| 503 #logging.debug(src.attrib) | |
| 504 | |
| 505 else: | |
| 506 link ="" | |
| 507 | |
| 508 #<dcterms:abstract xml:lang="deu">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.</dcterms:abstract> | |
| 509 #<dcterms:abstract xml:lang="eng">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.</dcterms:abstract> | |
| 510 | |
| 511 abstracts = citation.findall(abstractpath) | |
| 512 | |
| 513 abstractTexts={} | |
| 514 for abstract in abstracts: | |
| 515 | |
| 516 lang = abstract.get("{http://www.w3.org/XML/1998/namespace}lang") | |
| 517 abstractTexts[lang]=abstract.text | |
| 6 | 518 |
| 519 authorsTags = citation.findall(creatorpath) | |
| 520 | |
| 521 authors=[] | |
| 522 for author in authorsTags: | |
| 523 | |
| 524 gn= author.find(givenNamepath).text | |
| 525 fn= author.find(familyNamepath).text | |
| 526 | |
| 527 authors.append((fn,gn)) | |
| 528 | |
|
8
ddd7e357e518
changed getPreprints to getPublicationsFromContext. returns simple list.
casties
parents:
7
diff
changeset
|
529 titleTag = citation.find(titlepath) |
| 6 | 530 |
| 531 if titleTag is not None: | |
| 532 title = titleTag.text | |
| 533 else: | |
| 534 title="" | |
| 535 | |
| 536 issuedTag = citation.find(issuedpath) | |
| 537 | |
| 538 if issuedTag is not None: | |
| 539 issued = issuedTag.text | |
| 540 else: | |
| 541 issued="" | |
| 4 | 542 |
|
8
ddd7e357e518
changed getPreprints to getPublicationsFromContext. returns simple list.
casties
parents:
7
diff
changeset
|
543 item = {"id":objId, |
|
ddd7e357e518
changed getPreprints to getPublicationsFromContext. returns simple list.
casties
parents:
7
diff
changeset
|
544 "citation":text.text, |
|
ddd7e357e518
changed getPreprints to getPublicationsFromContext. returns simple list.
casties
parents:
7
diff
changeset
|
545 "volume":vol.text, |
|
ddd7e357e518
changed getPreprints to getPublicationsFromContext. returns simple list.
casties
parents:
7
diff
changeset
|
546 "link":link, |
|
ddd7e357e518
changed getPreprints to getPublicationsFromContext. returns simple list.
casties
parents:
7
diff
changeset
|
547 "abstracts":abstractTexts, |
|
ddd7e357e518
changed getPreprints to getPublicationsFromContext. returns simple list.
casties
parents:
7
diff
changeset
|
548 "authors":authors, |
|
ddd7e357e518
changed getPreprints to getPublicationsFromContext. returns simple list.
casties
parents:
7
diff
changeset
|
549 "title":title, |
|
ddd7e357e518
changed getPreprints to getPublicationsFromContext. returns simple list.
casties
parents:
7
diff
changeset
|
550 "year":issued} |
|
ddd7e357e518
changed getPreprints to getPublicationsFromContext. returns simple list.
casties
parents:
7
diff
changeset
|
551 |
|
ddd7e357e518
changed getPreprints to getPublicationsFromContext. returns simple list.
casties
parents:
7
diff
changeset
|
552 ret.append(item) |
| 9 | 553 |
| 554 logging.debug("getPublicationsFromContext: done in %ss"%(time.time()-startTime)) | |
| 4 | 555 return ret |
| 556 | |
| 557 | |
| 558 | |
| 0 | 559 |
| 560 def manage_addZopePubmanConnectorForm(self): | |
| 561 """Form for external Links""" | |
| 562 pt=zptFile(self, 'zpt/AddZopePubmanConnector.zpt') | |
| 563 return pt() | |
| 564 | |
| 565 | |
| 566 def manage_addZopePubmanConnector(self,id,title,pubmanURL,RESPONSE=None): | |
| 567 """Add an external Link""" | |
| 568 | |
| 569 newObj=ZopePubmanConnector(id,title,pubmanURL) | |
| 570 | |
| 571 self._setObject(id,newObj) | |
| 572 | |
| 573 if RESPONSE is not None: | |
| 574 RESPONSE.redirect('manage_main') | |
| 17 | 575 |
