[saem-devel] [PATCH 1 of 1 skos] [rdf] Don't propagate exception if language isn't accepted by rdflib

Denis Laxalde denis.laxalde at logilab.fr
Thu Feb 23 10:00:17 CET 2017


Sylvain Thenault a écrit :
> # HG changeset patch
> # User Sylvain Thénault <sylvain.thenault at logilab.fr>
> # Date 1485776389 -3600
> #      Mon Jan 30 12:39:49 2017 +0100
> # Node ID dabbe335e45634a7d8d1d129fa02bb49ab3f28c3
> # Parent  68ddcfc7441e9d3d03df516764e1a6c8ce127240
> [rdf] Don't propagate exception if language isn't accepted by rdflib
>
> diff --git a/rdfio.py b/rdfio.py
> --- a/rdfio.py
> +++ b/rdfio.py
> @@ -256,11 +256,14 @@ class AbstractRDFGraph(object):
>          """
>          assert isinstance(subj, self.uri)
>          assert isinstance(predicate, self.uri)
>          if not isinstance(obj, self.uri):
>              if isinstance(obj, unicode_with_language):
> -                obj = self._literal(text_type(obj), lang=obj.lang)
> +                try:
> +                    obj = self._literal(text_type(obj), lang=obj.lang)
> +                except Exception:
> +                    obj = self._literal(obj)

Nothing more specific than Exception? Might be worth adding a comment in
except block to explain.



More information about the saem-devel mailing list