[Python-modules-commits] [python-pyld] 04/05: Drop null `@language` values when expanding.

Wolfgang Borgert debacle at moszumanska.debian.org
Tue Oct 13 22:56:30 UTC 2015


This is an automated email from the git hooks/post-receive script.

debacle pushed a commit to tag 0.6.7
in repository python-pyld.

commit fd48d03b3ead2e61a46030c80d935bdbf68fac0e
Author: Dave Longley <dlongley at digitalbazaar.com>
Date:   Sat Feb 7 20:05:06 2015 -0500

    Drop null `@language` values when expanding.
    
    - There's an inconsistency between the syntax spec and the API
      spec; the API spec throws an error if null is used for a
      `@language` value on Step 7.4.7 of the Expansion Algorithm,
      but the syntax spec allows it. When used, it indicates the
      value has no language -- which is the same as if `@language`
      were omitted, so it's treated the same way in this patch.
---
 lib/pyld/jsonld.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/pyld/jsonld.py b/lib/pyld/jsonld.py
index 32bb8e5..4b8294d 100644
--- a/lib/pyld/jsonld.py
+++ b/lib/pyld/jsonld.py
@@ -1998,6 +1998,10 @@ class JsonLdProcessor(object):
 
             # @language must be a string
             if expanded_property == '@language':
+                if value is None:
+                    # drop null @language values, they expand as if they
+                    # didn't exist
+                    continue
                 if not _is_string(value):
                     raise JsonLdError(
                         'Invalid JSON-LD syntax; "@language" value must be '

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-pyld.git



More information about the Python-modules-commits mailing list