<% repourl = None errorCode = '' type('text/xml; charset=utf-8') domainId = args.domainId if args.saharaIdentifier: repositoryId, identifier = str(args.saharaIdentifier).split(':',1) else: repositoryId = str(args.repositoryId) identifier = str(args.identifier) if repositoryId and identifier: from os.path import isfile if isfile(req.document_root() + '/%s.%s.repository'%(domainId,repositoryId)): repo = asxml(url('/xml/%s.%s.repository'%(domainId,repositoryId))).repository repourl = repo.baseurl metadataPrefix = args.metadataPrefix or repo.metadataPrefix if not repourl: errorCode = 'idDoesNotExist' else: errorCode = 'idDoesNotExist' else: errorCode = 'badArgument' if not errorCode: includeurl = '%s?%s'%(repourl, urlencode({'verb':'GetRecord', 'metadataPrefix':metadataPrefix, 'identifier':identifier}) ) #This hack was introduced by TJ and KVS 2006/06/12 #it's a workaround for Groningen's server which cannot deal with the #"Accept-Encoding: identity" header produced by urllib2 (and standard HTTP) #urllib2 is used by the url function if 'rug.nl/' in includeurl: from urllib import urlopen oaigetrecord = asxml(urlopen(includeurl)) else: oaigetrecord = asxml(url(includeurl)) errOAI = str(oaigetrecord.OAI_PMH.error.code) %> <% include('/saharagetTime') %> GetRecord <% escape_xml(domainId) %> <% escape_xml(repositoryId) %>:<% escape_xml(identifier) %> <% if not errOAI: # %> <% oaigetrecord.OAI_PMH.GetRecord.record.xml(req) %> <% else: oaigetrecord.OAI_PMH.error.xml(req) # %> <% else: import time include('/saharageterror?errorCode=' + errorCode) %>