Commit 89622931 authored by Jean-Baptiste Pasquier's avatar Jean-Baptiste Pasquier

Merge branch '153' into 'master'

bugfix: Do not erase @context during serialisation when already defined...

See merge request !107
parents 3f5a2e14 6a7296af
Pipeline #6493 passed with stage
in 1 minute and 20 seconds
......@@ -25,8 +25,14 @@ class JSONLDRenderer(JSONRenderer):
media_type = 'application/ld+json'
def render(self, data, accepted_media_type=None, renderer_context=None):
if data is not None:
data["@context"] = settings.LDP_RDF_CONTEXT
if isinstance(data, dict):
context = data.get("@context")
if isinstance(context, list):
data["@context"] = [settings.LDP_RDF_CONTEXT] + context
elif isinstance(context, str) or isinstance(context, dict):
data["@context"] = [settings.LDP_RDF_CONTEXT, context]
else:
data["@context"] = settings.LDP_RDF_CONTEXT
return super(JSONLDRenderer, self).render(data, accepted_media_type, renderer_context)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment