Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F80270668
oai2d.py.wml
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Aug 30, 20:24
Size
3 KB
Mime Type
text/x-c
Expires
Sun, Sep 1, 20:24 (2 d)
Engine
blob
Format
Raw Data
Handle
20259690
Attached To
R3600 invenio-infoscience
oai2d.py.wml
View Options
## $Id$
## OAI interface for CDSware/MySQL written in Python compliant with OAI-PMH2.0
## This file is part of the CERN Document Server Software (CDSware).
## Copyright (C) 2002 CERN.
##
## The CDSware is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) any later version.
##
## The CDSware is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with CDSware; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
## read config variables:
#include "config.wml"
#include "configbis.wml"
<protect>#!</protect><PYTHON>
<protect>## $Id$</protect>
<protect>## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDSware WML SOURCES.</protect>
"""OAI interface for CDSware/MySQL written in Python compliant with OAI-PMH2.0"""
__lastupdated__ = """<: print `date +"%d %b %Y %H:%M:%S %Z"`; :>"""
__version__ = "$Id$"
## fill config variables:
pylibdir = "<LIBDIR>/python"
## OAI config variables
oaiidprefix = "<OAIIDPREFIX>"
oaisampleidentifier = "<OAISAMPLEIDENTIFIER>"
oaiidentifydescription = """<OAIIDENTIFYDESCRIPTION>"""
oaiidfield = "909COo"
oaisetfield = "909COp"
try:
import sys
import urllib
sys.path.append('%s' % pylibdir)
from cdsware.config import *
from cdsware.dbquery import run_sql
from cdsware import oai_repository
except ImportError, e:
import sys
sys.stderr.write("Error: %s" % e)
sys.exit(1)
def index (req):
"OAI repository interface"
## parse input parameters
args = ""
if req.method == "GET":
args = req.args
elif req.method == "POST":
params = {}
for key in req.form.keys():
params[key] = req.form[key]
args = urllib.urlencode(params)
arg = oai_repository.parse_args(args)
## check request for OAI compliancy
oai_error = oai_repository.check_args(arg)
## create OAI response
req.content_type = "text/xml"
req.send_http_header()
if oai_error == "":
## OAI Identify
if arg['verb'] == "Identify":
req.write(oai_repository.OAIIdentify(args))
## OAI ListSets
elif arg['verb'] == "ListSets":
req.write(oai_repository.OAIListSets(args))
## OAI ListIdentifiers
elif arg['verb'] == "ListIdentifiers":
req.write(oai_repository.OAIListIdentifiers(args))
## OAI ListRecords
elif arg['verb'] == "ListRecords":
req.write(oai_repository.OAIListRecords(args))
## OAI GetRecord
elif arg['verb'] == "GetRecord":
req.write(oai_repository.OAIGetRecord(args))
## OAI ListMetadataFormats
elif arg['verb'] == "ListMetadataFormats":
req.write(oai_repository.OAIListMetadataFormats(args))
## Unknown verb
else:
req.write(oai_repository.oai_error("badVerb","Illegal OAI verb"))
## OAI error
else:
req.write(oai_repository.oai_header(args,""))
req.write(oai_error)
req.write(oai_repository.oai_footer(""))
return "\n"
Event Timeline
Log In to Comment