Mercurial > hg > ZopePubmanConnector
comparison zopePubmanConnector.py @ 3:602b6e46b176
error handling bei falscher suche
author | dwinter |
---|---|
date | Tue, 30 Apr 2013 18:34:18 +0200 |
parents | 9dbb9354abbe |
children | f845502cf73a |
comparison
equal
deleted
inserted
replaced
2:9dbb9354abbe | 3:602b6e46b176 |
---|---|
75 cn+="&maximumRecords=%s"%limit | 75 cn+="&maximumRecords=%s"%limit |
76 | 76 |
77 logging.debug(cn) | 77 logging.debug(cn) |
78 resp, content = h.request(cn) | 78 resp, content = h.request(cn) |
79 | 79 |
80 logging.debug(content) | 80 |
81 | 81 |
82 ET.register_namespace("dcterms", "http://purl.org/dc/terms/") | 82 ET.register_namespace("dcterms", "http://purl.org/dc/terms/") |
83 | 83 |
84 root = ET.fromstring(content) | 84 root = ET.fromstring(content) |
85 | 85 |
146 | 146 |
147 logging.debug(cn%query) | 147 logging.debug(cn%query) |
148 resp, content = h.request(cn%query) | 148 resp, content = h.request(cn%query) |
149 | 149 |
150 ET.register_namespace("dcterms", "http://purl.org/dc/terms/") | 150 ET.register_namespace("dcterms", "http://purl.org/dc/terms/") |
151 | 151 |
152 root = ET.fromstring(content) | 152 try: |
153 | 153 root = ET.fromstring(content) |
154 except: | |
155 logging.error("Couldn't parse content of:%s"%(cn%query)) | |
156 return {} | |
154 #<escidocItem:item objid="escidoc:630782" | 157 #<escidocItem:item objid="escidoc:630782" |
155 | 158 |
156 citationxpath=".//{http://purl.org/dc/terms/}bibliographicCitation" | 159 citationxpath=".//{http://purl.org/dc/terms/}bibliographicCitation" |
157 | 160 |
158 objxpath=".//{http://www.escidoc.de/schemas/item/0.8}item" | 161 objxpath=".//{http://www.escidoc.de/schemas/item/0.8}item" |
171 return ret | 174 return ret |
172 | 175 |
173 | 176 |
174 | 177 |
175 def getEntryFromPubman(self,escidocid): | 178 def getEntryFromPubman(self,escidocid): |
176 | 179 escidocid=escidocid.lstrip().strip() |
177 h = httplib2.Http() | 180 h = httplib2.Http() |
178 cn = self.connectorString+"cqlQuery=escidoc.objid=%s&" | 181 cn = self.connectorString+"cqlQuery=escidoc.objid=%s&" |
179 cn +="exportFormat=APA&outputFormat=snippet&language=all&sortKeys=escidoc.any-dates&sortOrder=descending" | 182 cn +="exportFormat=APA&outputFormat=snippet&language=all&sortKeys=escidoc.any-dates&sortOrder=descending" |
180 | 183 |
181 resp, content = h.request(cn%escidocid) | 184 resp, content = h.request(cn%escidocid) |
182 ET.register_namespace("dcterms", "http://purl.org/dc/terms/") | 185 ET.register_namespace("dcterms", "http://purl.org/dc/terms/") |
183 | 186 logging.debug(cn%escidocid) |
187 | |
184 root = ET.fromstring(content) | 188 root = ET.fromstring(content) |
185 | 189 |
186 | 190 |
187 citationxpath=".//{http://purl.org/dc/terms/}bibliographicCitation" | 191 citationxpath=".//{http://purl.org/dc/terms/}bibliographicCitation" |
188 | 192 |