[Python-modules-commits] [python-pyld] 186/276: Ensure remote frames are parsed.

Wolfgang Borgert debacle at moszumanska.debian.org
Wed Oct 8 23:48:09 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 11018ff0ab679c33f6492683d82416217b19b722
Author: Dave Longley <dlongley at digitalbazaar.com>
Date:   Tue Sep 10 12:41:27 2013 -0400

    Ensure remote frames are parsed.
---
 lib/pyld/jsonld.py | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/lib/pyld/jsonld.py b/lib/pyld/jsonld.py
index 0eabaf2..113d96d 100644
--- a/lib/pyld/jsonld.py
+++ b/lib/pyld/jsonld.py
@@ -580,8 +580,8 @@ class JsonLdProcessor:
                 remote_doc['document'] = json.loads(remote_doc['document'])
         except Exception as cause:
             raise JsonLdError(
-                'Could not retrieve a JSON-LD document from the URL. URL '
-                'derefencing not implemented.', 'jsonld.LoadDocumentError',
+                'Could not retrieve a JSON-LD document from the URL.',
+                'jsonld.LoadDocumentError',
                  {'remoteDoc': remote_doc}, code='loading document failed',
                  cause=cause)
 
@@ -713,6 +713,20 @@ class JsonLdProcessor:
                 'document': frame
             }
 
+        try:
+            if remote_frame['document'] is None:
+                raise JsonLdError(
+                    'No remote document found at the given URL.',
+                    'jsonld.NullRemoteDocument')
+            if _is_string(remote_frame['document']):
+                remote_frame['document'] = json.loads(remote_frame['document'])
+        except Exception as cause:
+            raise JsonLdError(
+                'Could not retrieve a JSON-LD document from the URL.',
+                'jsonld.LoadDocumentError',
+                 {'remoteDoc': remote_doc}, code='loading document failed',
+                 cause=cause)
+
         # preserve frame context
         frame = remote_frame['document']
         if frame is not None:

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