[Python-modules-commits] [python-pyld] 145/276: Ensure expandContext URL option is processed.

Wolfgang Borgert debacle at moszumanska.debian.org
Wed Oct 8 23:48:03 UTC 2014


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

debacle pushed a commit to branch master
in repository python-pyld.

commit 1a527c5bb7571ab6f8a2a87be700b052a5434a51
Author: Dave Longley <dlongley at digitalbazaar.com>
Date:   Tue Jul 16 15:15:47 2013 -0400

    Ensure expandContext URL option is processed.
---
 lib/pyld/jsonld.py | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/lib/pyld/jsonld.py b/lib/pyld/jsonld.py
index 2dbce53..94346c2 100644
--- a/lib/pyld/jsonld.py
+++ b/lib/pyld/jsonld.py
@@ -497,6 +497,12 @@ class JsonLdProcessor:
             'document': copy.deepcopy(input_),
             'remoteContext': {'@context': remote_doc['contextUrl']}
         }
+        if 'expandContext' in options:
+            expandContext = options['expandContext']
+            if _is_object(expandContext) and '@context' in expandContext:
+                input_['expandContext'] = copy.deepcopy(expandContext)
+            else:
+                input_['expandContext'] = {'@context': expandContext}
 
         try:
             self._retrieve_context_urls(
@@ -510,12 +516,14 @@ class JsonLdProcessor:
         remote_context = input_['remoteContext']['@context']
 
         # process optional expandContext
-        if 'expandContext' in options:
-            self.process_context(active_ctx, options['expandContext'], options)
+        if 'expandContext' in input_:
+            active_ctx = self.process_context(
+                active_ctx, input_['expandContext']['@context'], options)
 
         # process remote context from HTTP Link Header
         if remote_context is not None:
-            self.process_context(active_ctx, remote_context, options)
+            active_ctx = self.process_context(
+                active_ctx, remote_context, options)
 
         # do expansion
         expanded = self._expand(active_ctx, None, document, options, False)

-- 
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