def _get_annotations(self, pid): try: annotations = client.annotations(pid) except client.PelagiosAPIError as e: annotations = None log.exception("Pelagios API Error: %s", str(e)) return annotations
def __call__(self, **kw): data = {} context = self.context if IPlace.providedBy(context): pid = context.getId() # local id like "149492" elif ILocation.providedBy(context) or IName.providedBy(context): pid = aq_parent(aq_inner(context)).getId() else: pid = None if pid is not None: try: annotations = client.annotations(pid) self.request.response.setStatus(200) except client.PelagiosAPIError, e: annotations = [] log.exception("Pelagios API Error: %s", str(e)) self.request.response.setStatus(500)