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

Sylvain Thénault sylvain.thenault at logilab.fr
Fri Feb 24 16:46:01 CET 2017



Le 23/02/2017 à 10:00, Denis Laxalde a écrit :
> 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.

sent a new version

-- 
Sylvain Thénault, LOGILAB, Paris (01.45.32.03.12) - Toulouse (05.62.17.16.42)
Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
CubicWeb, the semantic web framework:    http://www.cubicweb.org



More information about the saem-devel mailing list