[Python-modules-commits] [python-pyld] 106/276: Support strings passed into process_context.

Wolfgang Borgert debacle at moszumanska.debian.org
Wed Oct 8 23:47:58 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 d81d5e281a6cf00d7beff35571f90b13933094d8
Author: Dave Longley <dlongley at digitalbazaar.com>
Date:   Thu Apr 4 02:54:40 2013 -0400

    Support strings passed into process_context.
---
 lib/pyld/jsonld.py | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/lib/pyld/jsonld.py b/lib/pyld/jsonld.py
index b6dc4fe..57ccb88 100644
--- a/lib/pyld/jsonld.py
+++ b/lib/pyld/jsonld.py
@@ -22,7 +22,7 @@ __all__ = ['compact', 'expand', 'flatten', 'frame', 'from_rdf', 'to_rdf',
     'JsonLdProcessor', 'ContextCache']
 
 import copy, hashlib, json, os, re, string, sys, time, traceback
-import urllib2, urlparse, posixpath
+import urllib2, urlparse, posixpath, socket, ssl
 from contextlib import closing
 from collections import deque
 from functools import cmp_to_key
@@ -778,19 +778,20 @@ class JsonLdProcessor:
         options.setdefault('loadContext', _default_context_loader)
 
         # retrieve URLs in local_ctx
-        ctx = copy.deepcopy(local_ctx)
-        if _is_object(ctx) and '@context' not in ctx:
-            ctx = {'@context': ctx}
+        local_ctx = copy.deepcopy(local_ctx)
+        if (_is_string(local_ctx) or (
+            _is_object(local_ctx) and '@context' not in local_ctx)):
+            local_ctx = {'@context': local_ctx}
         try:
             self._retrieve_context_urls(
-                ctx, {}, options['loadContext'], options['base'])
+                local_ctx, {}, options['loadContext'], options['base'])
         except Exception as cause:
             raise JsonLdError(
                 'Could not process JSON-LD context.',
                 'jsonld.ContextError', None, cause)
 
         # process context
-        return self._process_context(active_ctx, ctx, options)
+        return self._process_context(active_ctx, local_ctx, options)
 
     def register_rdf_parser(self, content_type, parser):
         """

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