From 8ac6779bb13ff263c946ffd1ed856dbd80f8e883 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Wed, 15 Feb 2012 16:42:08 +0530 Subject: [PATCH] fix 404 response --- pandora/item/views.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pandora/item/views.py b/pandora/item/views.py index cf3bb1b1f..7b3a632b8 100644 --- a/pandora/item/views.py +++ b/pandora/item/views.py @@ -1005,10 +1005,9 @@ def item_json(request, id): response = json_response(status=404, text='not found') else: item = qs[0] - j = item.get_json() - j['layers'] = item.get_layers(request.user) - response = render_to_json_response(j) - return response + response = item.get_json() + response['layers'] = item.get_layers(request.user) + return render_to_json_response(response) def item_xml(request, id): level = settings.CONFIG['capabilities']['canSeeItem']['guest'] @@ -1017,6 +1016,7 @@ def item_xml(request, id): qs = models.Item.objects.filter(itemId=id, level__lte=level) if qs.count() == 0: response = json_response(status=404, text='not found') + response = render_to_json_response(response) else: item = qs[0] j = item.get_json() @@ -1025,8 +1025,9 @@ def item_xml(request, id): def xmltree(root, key, data): if isinstance(data, list) or \ isinstance(data, tuple): + e = ET.SubElement(root, key) for value in data: - xmltree(root, key, value) + xmltree(e, key, value) elif isinstance(data, dict): for k in data: if data[k]: