From 73fba431ae750c1e6930e97ab76e331fabdd6067 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 4 Nov 2013 09:53:16 -0500 Subject: [PATCH] Fix json output mistakes. I may wish to change http api to a single json dumps. At that point the socket api would be the only consumer of the piecewise json messages. Merging the json data is a non-trivial problem and httpapi is doing too much hand assembly of the data. http api would lose any hope of one request, staggered response behavior as a result, but http is a terrible protocol for that anyway and there is always the socket api --- confluent/httpapi.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/confluent/httpapi.py b/confluent/httpapi.py index ab6774c7..cb9d6d4d 100644 --- a/confluent/httpapi.py +++ b/confluent/httpapi.py @@ -263,10 +263,15 @@ def _assemble_html(responses, resource, querydict): def _assemble_json(responses, resource): + #NOTE(jbjohnso) I'm considering giving up on yielding bit by bit + #in json case over http. Notably, duplicate key values from plugin + #overwrite, but we'd want to preserve them into an array instead. + #the downside is that http would just always blurt it ll out at + #once and hold on to all the data in memory docomma = False links = { - 'self': ['{"href"="%s"' % resource], - 'collection': ['{"href"="%s"' % '../'], + 'self': ['{"href":"%s"}' % resource], + 'collection': ['{"href":"%s"}' % '../'], } yield '{' hadrsp = False