Skip to content

Backward compatibility with Pyoai is broken #3

Description

@akorosov

I was following exactly the Readme:

git clone https://github.com/infrae/moai.git
cd moai/
source bin/activate
pip install -e .
./bin/update_moai moai_example
./bin/paster serve settings.ini

After trying to access
http://localhost:8080/oai?verb=ListIdentifiers&metadataPrefix=oai_dc
The following error appeared:

ERROR:root:Traceback (most recent call last):
  File "/home/antonk/py/moai/local/lib/python2.7/site-packages/wsgiutils/wsgiServer.py", line 126, in runWSGIApp
    result = application (env, self.wsgiStartResponse)
  File "/home/antonk/py/moai/local/lib/python2.7/site-packages/paste/translogger.py", line 69, in __call__
    return self.application(environ, replacement_start_response)
  File "/home/antonk/py/moai/local/lib/python2.7/site-packages/paste/urlmap.py", line 216, in __call__
    return app(environ, start_response)
  File "/home/antonk/py/moai/moai/wsgi.py", line 72, in __call__
    response = self.server.handle_request(WSGIRequest(request))
  File "/home/antonk/py/moai/moai/server.py", line 118, in handle_request
    return req.write(oai_server.handleRequest(req.query_dict()), 'text/xml')
  File "/home/antonk/py/moai/local/lib/python2.7/site-packages/oaipmh/server.py", line 311, in handleRequest
    return self.handleException(request_kw, sys.exc_info())
  File "/home/antonk/py/moai/local/lib/python2.7/site-packages/oaipmh/server.py", line 323, in handleException
    self._tree_server.handleException(value).getroot(),
  File "/home/antonk/py/moai/local/lib/python2.7/site-packages/oaipmh/server.py", line 308, in handleRequest
    return self.handleVerb(verb, request_kw)
  File "/home/antonk/py/moai/local/lib/python2.7/site-packages/oaipmh/server.py", line 315, in handleVerb
    return etree.tostring(method(**kw).getroot(),
  File "/home/antonk/py/moai/local/lib/python2.7/site-packages/oaipmh/server.py", line 114, in listIdentifiers
    kw)
  File "/home/antonk/py/moai/local/lib/python2.7/site-packages/oaipmh/server.py", line 203, in _outputResuming
    result, token = input_func(**kw)
  File "/home/antonk/py/moai/local/lib/python2.7/site-packages/oaipmh/common.py", line 126, in method
    return obj(self, **kw)
  File "/home/antonk/py/moai/local/lib/python2.7/site-packages/oaipmh/common.py", line 121, in __call__
    return bound_self.handleVerb(self._verb, kw)
  File "/home/antonk/py/moai/local/lib/python2.7/site-packages/oaipmh/server.py", line 425, in handleVerb
    result = list(result)
  File "/home/antonk/py/moai/moai/oai.py", line 90, in listIdentifiers
    yield self._createHeader(record)
  File "/home/antonk/py/moai/moai/oai.py", line 115, in _createHeader
    deleted)
TypeError: __init__() takes exactly 6 arguments (5 given)

Similar issue with oaipmh.common.Metadata(record)

Apparently the recent change in pyoai
infrae/pyoai@46a57f8
introduced new function call pattern.

Suggested fix:

add None to the function call e.g.

oaipmh.common.Header(None
                                    record['id'],
                                    record['modified'],
                                    record['sets'],
                                    deleted)

oaipmh.common.Metadata(None, record)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions