def GetRecord(params): try: c.identifier = params["identifier"] if params["by_doc_ID"] == True: c.docList = [o.get_record(params["identifier"])] else: c.docList = o.get_records_by_resource(params["identifier"]) if len(c.docList) == 0: raise IdDoesNotExistError(params['verb']) except ResourceNotFound: raise IdDoesNotExistError(params['verb']) self._initRender(params) if c.docList != None: for doc in c.docList: if c.metadataPrefix not in doc["payload_schema"]: raise CannotDisseminateFormatError(params['verb']) body = "<error/>" try: body = render("/oaipmh-GetRecord.mako") except: log.exception("Unable to render template") return self._returnResponse(body)
def Identify(params=None): body = "" try: self._initRender(params) c.identify = o.identify() body = render("/oaipmh-Identify.mako") except Exception as e: raise BadVerbError() return self._returnResponse(body)
def Identify(params=None): body = "" try: self._initRender(params, ctx=c, req=t_req) c.identify = o.identify() body = render("/oaipmh-Identify.mako") except Exception as e: raise BadVerbError() return self._returnResponse(body, res=t_res)
def index(self): c.collection_url = 'http://' + request.host if sourceLRNode.nodeDescription.node_name is not None: c.node_name = sourceLRNode.nodeDescription.node_name else: c.node_name = sourceLRNode.nodeDescription.node_id c.node_description = sourceLRNode.nodeDescription.node_description if sourceLRNode.communityDescription.community_name is not None: c.community_name = sourceLRNode.communityDescription.community_name else: c.community_name = sourceLRNode.communityDescription.community_id return render('sword.mako')
def index(self): c.collection_url = urlparse.urljoin(self.baseUrl, 'swordpub') if sourceLRNode.nodeDescription.node_name is not None: c.node_name = sourceLRNode.nodeDescription.node_name else: c.node_name = sourceLRNode.nodeDescription.node_id c.node_description = sourceLRNode.nodeDescription.node_description if sourceLRNode.communityDescription.community_name is not None: c.community_name = sourceLRNode.communityDescription.community_name else: c.community_name = sourceLRNode.communityDescription.community_id return render('sword.mako')
def create(self): if c.no_op: result = {'OK':True} c.doc = {'doc_ID':12345} else: result = m.publish(json.loads(request.body)) if result['OK']: c.content_url = 'http://' + request.host + '/obtain/'+result['doc_ID'] c.doc = self.h.get_record(result['doc_ID']) return render('sword-publish.mako') else: raise SwordError(result['error'])
def index(self): c.collection_url = urlparse.urljoin(self.baseUrl,'swordpub') if sourceLRNode.nodeDescription.node_name is not None: c.node_name = sourceLRNode.nodeDescription.node_name else: c.node_name = sourceLRNode.nodeDescription.node_id c.node_description = sourceLRNode.nodeDescription.node_description if sourceLRNode.communityDescription.community_name is not None: c.community_name = sourceLRNode.communityDescription.community_name else: c.community_name = sourceLRNode.communityDescription.community_id return render('sword.mako')
def create(self): if c.no_op: result = {'OK':True} c.doc = {'doc_ID':12345} else: result = m.publish(json.loads(request.body)) if result['OK']: c.content_url = urlparse.urljoin(self.baseUrl,'obtain') + '?request_id=%s&by_doc_ID=true' % result['doc_ID'] c.doc = self.h.get_record(result['doc_ID']) return render('sword-publish.mako') else: raise SwordError(result['error'])
def ListMetadataFormats(params): body = "" try: self._initRender(params) fmts = o.list_metadata_formats(identity=params["identifier"], by_doc_ID=params["by_doc_ID"]) if len(fmts) == 0: raise NoMetadataFormats(params["verb"]) c.formats = fmts body = render("/oaipmh-ListMetadataFormats.mako") return self._returnResponse(body) except Error as e: raise e
def ListMetadataFormats(params): body = "" try: self._initRender(params, ctx=c, req=t_req) fmts = o.list_metadata_formats(identity=params["identifier"], by_doc_ID=params["by_doc_ID"]) if len(fmts) == 0: raise NoMetadataFormats(params["verb"]) c.formats = fmts body = render("/oaipmh-ListMetadataFormats.mako") return self._returnResponse(body, res=t_res) except Error as e: raise e
def create(self): if c.no_op: result = {'OK': True} c.doc = {'doc_ID': 12345} else: result = m.publish(json.loads(request.body)) if result['OK']: c.content_url = urlparse.urljoin( self.baseUrl, 'obtain') + '?request_id=%s&by_doc_ID=true' % result['doc_ID'] c.doc = self.h.get_record(result['doc_ID']) return render('sword-publish.mako') else: raise SwordError(result['error'])
def ListRecords(params): body = "" try: c.records = o.list_records(params["metadataPrefix"],from_date=params["from"], until_date=params["until"] ) if len(c.records) == 0: raise NoRecordsMatchError(params['verb']) self._initRender(params) body = render("/oaipmh-ListRecords.mako") except NoRecordsMatchError as e: raise e except: log.exception("Unable to render template") return self._returnResponse(body)
def ListRecords(params): body = "" try: c.records = o.list_records(params["metadataPrefix"], from_date=params["from"], until_date=params["until"]) if len(c.records) == 0: raise NoRecordsMatchError(params['verb']) self._initRender(params) body = render("/oaipmh-ListRecords.mako") except NoRecordsMatchError as e: raise e except: log.exception("Unable to render template") return self._returnResponse(body)
def _handleOAIRequest(self, format='html'): o = oaipmh() def GetRecord(params): try: c.identifier = params["identifier"] if params["by_doc_ID"] == True: c.docList = [o.get_record(params["identifier"])] else: c.docList = o.get_records_by_resource(params["identifier"]) if len(c.docList) == 0: raise IdDoesNotExistError(params['verb']) except ResourceNotFound: raise IdDoesNotExistError(params['verb']) self._initRender(params) if c.docList != None: for doc in c.docList: if c.metadataPrefix not in doc["payload_schema"]: raise CannotDisseminateFormatError(params['verb']) body = "<error/>" try: body = render("/oaipmh-GetRecord.mako") except: log.exception("Unable to render template") return self._returnResponse(body) def ListIdentifiers(params): body = "" try: c.identifiers = o.list_identifiers(params["metadataPrefix"], from_date=params["from"], until_date=params["until"]) if len(c.identifiers) == 0: raise NoRecordsMatchError(params['verb']) self._initRender(params) body = render("/oaipmh-ListIdentifiers.mako") except NoRecordsMatchError as e: raise e except: log.exception("Unable to render template") return self._returnResponse(body) def ListRecords(params): body = "" try: c.records = o.list_records(params["metadataPrefix"], from_date=params["from"], until_date=params["until"]) if len(c.records) == 0: raise NoRecordsMatchError(params['verb']) self._initRender(params) body = render("/oaipmh-ListRecords.mako") except NoRecordsMatchError as e: raise e except: log.exception("Unable to render template") return self._returnResponse(body) def Identify(params=None): body = "" try: self._initRender(params) c.identify = o.identify() body = render("/oaipmh-Identify.mako") except Exception as e: raise BadVerbError() return self._returnResponse(body) def ListMetadataFormats(params): body = "" try: self._initRender(params) fmts = o.list_metadata_formats(identity=params["identifier"], by_doc_ID=params["by_doc_ID"]) if len(fmts) == 0: raise NoMetadataFormats(params["verb"]) c.formats = fmts body = render("/oaipmh-ListMetadataFormats.mako") return self._returnResponse(body) except Error as e: raise e # except Exception as e: # raise NoMetadataFormats(params["verb"]) def ListSets(params=None): raise NoSetHierarchyError(verb) def NotYetSupported(params=None): raise BadVerbError() switch = { 'GetRecord': GetRecord, 'ListRecords': ListRecords, 'ListIdentifiers': ListIdentifiers, 'Identify': Identify, 'ListMetadataFormats': ListMetadataFormats, 'ListSets': ListSets } try: params = self._parseParams() # If this is a special case where we are actually using OAI interface to serve basic harvest if params.has_key("metadataPrefix") and params[ "metadataPrefix"] == "LR_JSON_0.10.0": if params.has_key("identifier") == True: params["request_id"] = params["identifier"] return HarvestController.harvest(self, params, request.body, params['verb'].lower()) verb = params['verb'] return switch[verb](params) except Error as e: c.error = e return self._returnResponse(render('oaipmh-Error.mako'))
def index(self): c.collection_url = 'http://' + request.host + '/obtain/' return render('sword.mako')
def get(): response.headers['Content-Type'] = 'text/html;charset=utf-8' return render("register.mako")
def _handleOAIRequest(self, format='html'): o = oaipmh() def GetRecord(params): try: c.identifier = params["identifier"] if params["by_doc_ID"] == True: c.docList = [o.get_record(params["identifier"])] else: c.docList = o.get_records_by_resource(params["identifier"]) if len(c.docList) == 0: raise IdDoesNotExistError(params['verb']) except ResourceNotFound: raise IdDoesNotExistError(params['verb']) self._initRender(params) if c.docList != None: for doc in c.docList: if c.metadataPrefix not in doc["payload_schema"]: raise CannotDisseminateFormatError(params['verb']) body = "<error/>" try: body = render("/oaipmh-GetRecord.mako") except: log.exception("Unable to render template") return self._returnResponse(body) def ListIdentifiers(params): body = "" try: c.identifiers = o.list_identifiers(params["metadataPrefix"],from_date=params["from"], until_date=params["until"] ) if len(c.identifiers) == 0: raise NoRecordsMatchError(params['verb']) self._initRender(params) body = render("/oaipmh-ListIdentifiers.mako") except NoRecordsMatchError as e: raise e except: log.exception("Unable to render template") return self._returnResponse(body) def ListRecords(params): body = "" try: c.records = o.list_records(params["metadataPrefix"],from_date=params["from"], until_date=params["until"] ) if len(c.records) == 0: raise NoRecordsMatchError(params['verb']) self._initRender(params) body = render("/oaipmh-ListRecords.mako") except NoRecordsMatchError as e: raise e except: log.exception("Unable to render template") return self._returnResponse(body) def Identify(params=None): body = "" try: self._initRender(params) c.identify = o.identify() body = render("/oaipmh-Identify.mako") except Exception as e: raise BadVerbError() return self._returnResponse(body) def ListMetadataFormats(params): body = "" try: self._initRender(params) fmts = o.list_metadata_formats(identity=params["identifier"], by_doc_ID=params["by_doc_ID"]) if len(fmts) == 0: raise NoMetadataFormats(params["verb"]) c.formats = fmts body = render("/oaipmh-ListMetadataFormats.mako") return self._returnResponse(body) except Error as e: raise e # except Exception as e: # raise NoMetadataFormats(params["verb"]) def ListSets(params=None): raise NoSetHierarchyError(verb) def NotYetSupported(params=None): raise BadVerbError() switch = { 'GetRecord': GetRecord, 'ListRecords': ListRecords, 'ListIdentifiers': ListIdentifiers, 'Identify': Identify, 'ListMetadataFormats': ListMetadataFormats, 'ListSets': ListSets } try: params = self._parseParams() # If this is a special case where we are actually using OAI interface to serve basic harvest if params.has_key("metadataPrefix") and params["metadataPrefix"] == "LR_JSON_0.10.0": if params.has_key("identifier") == True: params["request_id"] = params["identifier"] return HarvestController.harvest(self, params, request.body, params['verb'].lower()) verb = params['verb'] return switch[verb](params) except Error as e: c.error = e return self._returnResponse(render('oaipmh-Error.mako'))
def get(): response.headers["Content-Type"] = "text/html;charset=utf-8" return render("register.mako")
def get(): response.headers['Content-Type'] = 'text/html;charset=utf-8' return render("newauth.mako")