ietf-ribose / doi2ietf-py

Python port of `doilit` from kramdown-rfc2629
MIT License
1 stars 1 forks source link

AttributeError: 'NoneType' object has no attribute 'replace' #9

Open strogonoff opened 2 years ago

strogonoff commented 2 years ago

Getting the following when requesting a DOI ref.

The ref is DOI.10.6028/NIST.SP.800-53r5.

Calling as follows:

from doi2ietf import process_doi_list
doi_list = process_doi_list(['DOI.10.6028/NIST.SP.800-53r5'], 'XML')

Getting error:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/asgiref/sync.py", line 482, in thread_handler
    raise exc_info[1]
  File "/usr/local/lib/python3.10/site-packages/django/core/handlers/exception.py", line 38, in inner
    response = await get_response(request)
  File "/usr/local/lib/python3.10/site-packages/django/core/handlers/base.py", line 233, in _get_response_async
    response = await wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python3.10/site-packages/asgiref/sync.py", line 444, in __call__
    ret = await asyncio.wait_for(future, timeout=None)
  File "/usr/local/lib/python3.10/asyncio/tasks.py", line 408, in wait_for
    return await fut
  File "/usr/local/lib/python3.10/site-packages/asgiref/current_thread_executor.py", line 22, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.10/site-packages/asgiref/sync.py", line 486, in thread_handler
    return func(*args, **kwargs)
  File "/code/./main/api.py", line 87, in get_ref_by_legacy_path
    bibxml_repr = _get_doi_ref(parsed_ref, 'bibxml')
  File "/code/./main/external.py", line 21, in get_doi_ref
    doi_list = process_doi_list([ref], doi_format)
  File "/usr/local/lib/python3.10/site-packages/doi2ietf/utils.py", line 311, in process_doi_list
    return parse_doi_data(data_lst, output_format)
  File "/usr/local/lib/python3.10/site-packages/doi2ietf/utils.py", line 282, in parse_doi_data
    output.append(make_xml(doi_dict))
  File "/usr/local/lib/python3.10/site-packages/doi2ietf/utils.py", line 142, in make_xml
    output += xml_author_tag(author)
  File "/usr/local/lib/python3.10/site-packages/doi2ietf/utils.py", line 180, in xml_author_tag
    escape(person['name'])
  File "/usr/local/lib/python3.10/xml/sax/saxutils.py", line 27, in escape
    data = data.replace("&", "&")
AttributeError: 'NoneType' object has no attribute 'replace'
strogonoff commented 2 years ago

Actually, the error happens only if XML is requested. DICT is returned without an error.

strogonoff commented 2 years ago

(And the DOI apparently exists, it’s the same as in #11)