Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getty provider and languages #331

Closed
koenedaele opened this issue Aug 29, 2016 · 2 comments
Closed

Getty provider and languages #331

koenedaele opened this issue Aug 29, 2016 · 2 comments
Assignees
Labels
Milestone

Comments

@koenedaele
Copy link
Member

Issue found when matching Brussels with tgn:7024097

2016-08-29 12:09:17,680 ERROR [atramhasis.views.exception_views][waitress] x-flemish is not a valid IANA language tag.
Traceback (most recent call last):
  File "/home/koen/Virtualenvs/atramhasis/local/lib/python2.7/site-packages/pyramid/tweens.py", line 22, in excview_tween
    response = handler(request)
  File "/home/koen/Virtualenvs/atramhasis/local/lib/python2.7/site-packages/pyramid_tm/__init__.py", line 101, in tm_tween
    reraise(*exc_info)
  File "/home/koen/Virtualenvs/atramhasis/local/lib/python2.7/site-packages/pyramid_tm/__init__.py", line 83, in tm_tween
    response = handler(request)
  File "/home/koen/Virtualenvs/atramhasis/local/lib/python2.7/site-packages/pyramid/router.py", line 158, in handle_request
    view_name
  File "/home/koen/Virtualenvs/atramhasis/local/lib/python2.7/site-packages/pyramid/view.py", line 547, in _call_view
    response = view_callable(context, request)
  File "/home/koen/Virtualenvs/atramhasis/local/lib/python2.7/site-packages/pyramid/viewderivers.py", line 393, in attr_view
    return view(context, request)
  File "/home/koen/Virtualenvs/atramhasis/local/lib/python2.7/site-packages/pyramid/viewderivers.py", line 371, in predicate_wrapper
    return view(context, request)
  File "/home/koen/Virtualenvs/atramhasis/local/lib/python2.7/site-packages/pyramid/viewderivers.py", line 465, in rendered_view
    request, result, view_inst, context)
  File "/home/koen/Virtualenvs/atramhasis/local/lib/python2.7/site-packages/pyramid/renderers.py", line 432, in render_view
    return self.render_to_response(response, system, request=request)
  File "/home/koen/Virtualenvs/atramhasis/local/lib/python2.7/site-packages/pyramid/renderers.py", line 455, in render_to_response
    result = self.render(value, system_values, request=request)
  File "/home/koen/Virtualenvs/atramhasis/local/lib/python2.7/site-packages/pyramid/renderers.py", line 451, in render
    result = renderer(value, system_values)
  File "/home/koen/Virtualenvs/atramhasis/local/lib/python2.7/site-packages/pyramid/renderers.py", line 275, in _render
    return self.serializer(value, default=default, **self.kw)
  File "/usr/lib/python2.7/json/__init__.py", line 250, in dumps
    sort_keys=sort_keys, **kw).encode(obj)
  File "/usr/lib/python2.7/json/encoder.py", line 207, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python2.7/json/encoder.py", line 270, in iterencode
    return _iterencode(o, 0)
  File "/home/koen/Virtualenvs/atramhasis/local/lib/python2.7/site-packages/pyramid/renderers.py", line 289, in default
    return result(obj, request)
  File "/home/koen/Virtualenvs/atramhasis/local/lib/python2.7/site-packages/pyramid_skosprovider/renderers.py", line 45, in concept_adapter
    'broader': _map_relations(obj.broader, p, language),
  File "/home/koen/Virtualenvs/atramhasis/local/lib/python2.7/site-packages/pyramid_skosprovider/renderers.py", line 92, in _map_relations
    c = p.get_by_id(r)
  File "/home/koen/Virtualenvs/atramhasis/local/lib/python2.7/site-packages/skosprovider_getty/providers.py", line 76, in get_by_id
    things = things_from_graph(graph, self.subclasses, self.concept_scheme)
  File "/home/koen/Virtualenvs/atramhasis/local/lib/python2.7/site-packages/skosprovider_getty/utils.py", line 86, in things_from_graph
    labels = _create_from_subject_typelist(graph, sub, Label.valid_types),
  File "/home/koen/Virtualenvs/atramhasis/local/lib/python2.7/site-packages/skosprovider_getty/utils.py", line 119, in _create_from_subject_typelist
    list.extend(_create_from_subject_predicate(graph, subject, term, note_uris))
  File "/home/koen/Virtualenvs/atramhasis/local/lib/python2.7/site-packages/skosprovider_getty/utils.py", line 149, in _create_from_subject_predicate
    o = _create_label(o, type)
  File "/home/koen/Virtualenvs/atramhasis/local/lib/python2.7/site-packages/skosprovider_getty/utils.py", line 167, in _create_label
    return Label(literal.toPython(), type, language)
  File "/home/koen/Virtualenvs/atramhasis/local/lib/python2.7/site-packages/skosprovider/skos.py", line 66, in __init__
    raise ValueError('%s is not a valid IANA language tag.' % language)
ValueError: x-flemish is not a valid IANA language tag.

Issues with this:

  • language-tags claims x-flemish is not valid. Not really sure about that, I would expect a private tag to be allowed, but I might need to consult the specs more.
  • We should possibly have an option to not let this fail (by ignore the invalid label or so). But I don't like surpressing errorrs.
@koenedaele
Copy link
Member Author

Moved validness of x-flemish to OnroerendErfgoed/language-tags#15

@koenedaele
Copy link
Member Author

Currently solved by OnroerendErfgoed/skosprovider_getty#26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants