MI-DPLA / combine

Combine /kämˌbīn/ - Metadata Aggregator Platform
MIT License
26 stars 11 forks source link

GetRecord broken for OAI server #319

Closed ghukill closed 5 years ago

ghukill commented 5 years ago

ListIdentifiers and ListRecords both work, but retrieving a single record via GetRecord returns the following:

---------------------------------------------------------------------------
InvalidDocument                           Traceback (most recent call last)
/opt/combine/inc/console.py in <module>()
----> 1 r = pr.get_record('oai:michigan:tronky:oai:digital.library.wayne.edu:ochr:oai:demo.ptfs.com:library10_lib/13491')

/opt/combine/core/models.py in get_record(self, record_id)
   4331 
   4332                 # if one, return
-> 4333                 if record_query.count() == 1:
   4334                         return record_query.first()
   4335 

/usr/local/Miniconda3-4.3.30-Linux-x86_64/envs/combine/lib/python3.5/site-packages/mongoengine/queryset/queryset.py in count(self, with_limit_and_skip)
    131         """
    132         if with_limit_and_skip is False:
--> 133             return super(QuerySet, self).count(with_limit_and_skip)
    134 
    135         if self._len is None:

/usr/local/Miniconda3-4.3.30-Linux-x86_64/envs/combine/lib/python3.5/site-packages/mongoengine/queryset/base.py in count(self, with_limit_and_skip)
    399         if self._limit == 0 and with_limit_and_skip or self._none:
    400             return 0
--> 401         return self._cursor.count(with_limit_and_skip=with_limit_and_skip)
    402 
    403     def delete(self, write_concern=None, _from_doc_delete=False,

/usr/local/Miniconda3-4.3.30-Linux-x86_64/envs/combine/lib/python3.5/site-packages/pymongo/cursor.py in count(self, with_limit_and_skip)
    767 
    768         return self.__collection._count(
--> 769             cmd, self.__collation, session=self.__session)
    770 
    771     def distinct(self, key):

/usr/local/Miniconda3-4.3.30-Linux-x86_64/envs/combine/lib/python3.5/site-packages/pymongo/collection.py in _count(self, cmd, collation, session)
   1570                 read_concern=self.read_concern,
   1571                 collation=collation,
-> 1572                 session=session)
   1573         if res.get("errmsg", "") == "ns missing":
   1574             return 0

/usr/local/Miniconda3-4.3.30-Linux-x86_64/envs/combine/lib/python3.5/site-packages/pymongo/collection.py in _command(self, sock_info, command, slave_ok, read_preference, codec_options, check, allowable_errors, read_concern, write_concern, collation, session, retryable_write)
    242                 session=s,
    243                 client=self.__database.client,
--> 244                 retryable_write=retryable_write)
    245 
    246     def __create(self, options, collation, session):

/usr/local/Miniconda3-4.3.30-Linux-x86_64/envs/combine/lib/python3.5/site-packages/pymongo/pool.py in command(self, dbname, spec, slave_ok, read_preference, codec_options, check, allowable_errors, check_keys, read_concern, write_concern, parse_write_concern_error, collation, session, client, retryable_write, publish_events)
    582         # Catch socket.error, KeyboardInterrupt, etc. and close ourselves.
    583         except BaseException as error:
--> 584             self._raise_connection_failure(error)
    585 
    586     def send_message(self, message, max_doc_size):

/usr/local/Miniconda3-4.3.30-Linux-x86_64/envs/combine/lib/python3.5/site-packages/pymongo/pool.py in _raise_connection_failure(self, error)
    743             _raise_connection_failure(self.address, error)
    744         else:
--> 745             raise error
    746 
    747     def __eq__(self, other):

/usr/local/Miniconda3-4.3.30-Linux-x86_64/envs/combine/lib/python3.5/site-packages/pymongo/pool.py in command(self, dbname, spec, slave_ok, read_preference, codec_options, check, allowable_errors, check_keys, read_concern, write_concern, parse_write_concern_error, collation, session, client, retryable_write, publish_events)
    577                            compression_ctx=self.compression_context,
    578                            use_op_msg=self.op_msg_enabled,
--> 579                            unacknowledged=unacknowledged)
    580         except OperationFailure:
    581             raise

/usr/local/Miniconda3-4.3.30-Linux-x86_64/envs/combine/lib/python3.5/site-packages/pymongo/network.py in command(sock, dbname, spec, slave_ok, is_mongos, read_preference, codec_options, session, client, check, allowable_errors, address, check_keys, listeners, max_bson_size, read_concern, parse_write_concern_error, collation, compression_ctx, use_op_msg, unacknowledged)
    112         request_id, msg, size, max_doc_size = message._op_msg(
    113             flags, spec, dbname, read_preference, slave_ok, check_keys,
--> 114             codec_options, ctx=compression_ctx)
    115         # If this is an unacknowledged write then make sure the encoded doc(s)
    116         # are small enough, otherwise rely on the server to return an error.

/usr/local/Miniconda3-4.3.30-Linux-x86_64/envs/combine/lib/python3.5/site-packages/pymongo/message.py in _op_msg(flags, command, dbname, read_preference, slave_ok, check_keys, opts, ctx)
    677                 flags, command, identifier, docs, check_keys, opts, ctx)
    678         return _op_msg_uncompressed(
--> 679             flags, command, identifier, docs, check_keys, opts)
    680     finally:
    681         # Add the field back to the command.

InvalidDocument: Cannot encode object: <built-in function id>
ghukill commented 5 years ago

Fixed.