--- a/src/ldt/ldt/ldt_utils/views/json.py Thu Dec 13 17:42:29 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/views/json.py Fri Dec 14 17:48:30 2012 +0100
@@ -172,6 +172,18 @@
mashup_list["items"].append(res["element_id"])
mashup_dict["lists"].append(mashup_list)
+ # If asked, we remove the annotations not used in the mashup.
+ # It enabled a lighter response
+ remove_not_used_str = request.REQUEST.get("removenotused")
+ remove_not_used = False
+ if remove_not_used_str:
+ remove_not_used = {'true': True, 'false': False, "0": False, "1": True}.get(remove_not_used_str.lower())
+ if remove_not_used:
+ for a in mashup_dict["annotations"]:
+ if a["id"] not in mashup_list["items"]:
+ mashup_dict["annotations"].remove(a)
+
+
json_str = simplejson.dumps(mashup_dict, ensure_ascii=False, indent=indent)
if escape_bool:
json_str = escape(json_str)