eb90035deea59a5401f202b5f060a54f21fe53c3
[wolnelektury.git] / apps / oai / views.py
1
2 from oai.handlers import Catalogue
3 from oaipmh.server import ServerBase, oai_dc_writer, NS_OAIDC, NS_DC, NS_XSI
4 from oaipmh.metadata import MetadataRegistry
5 from django.http import HttpResponse
6 from lxml.etree import tostring
7
8 metadata_registry = MetadataRegistry()
9 metadata_registry.registerWriter('oai_dc', oai_dc_writer)
10 ns_map = {'oai_dc': NS_OAIDC, 'dc': NS_DC, 'xsi': NS_XSI}
11
12 server = ServerBase(Catalogue(metadata_registry), metadata_registry, ns_map)
13
14
15 def oaipmh(request):
16     resp = server.handleRequest(request.GET)
17     return HttpResponse(resp)