diff --git a/confluent/httpapi.py b/confluent/httpapi.py index cdfd8364..f61a1f57 100644 --- a/confluent/httpapi.py +++ b/confluent/httpapi.py @@ -236,14 +236,14 @@ def resourcehandler(env, start_response): return start_response('200 OK', headers) if mimetype == 'text/html': - for datum in _assemble_html(hdlr, resource, querydict): + for datum in _assemble_html(hdlr, resource, querydict, url): yield datum else: - for datum in _assemble_json(hdlr, resource): + for datum in _assemble_json(hdlr, resource, url): yield datum -def _assemble_html(responses, resource, querydict): +def _assemble_html(responses, resource, querydict, url): yield '' yield 'Confluent REST Explorer: ' + resource + '' yield '
' @@ -257,10 +257,9 @@ def _assemble_html(responses, resource, querydict): yield '' yield '' yield '%s
' % (resource, resource) - print 'got a %s' % resource - if resource in ('/', './'): + if url == '/': pass - if resource[-1] == '/': + elif resource[-1] == '/': yield '../
' else: yield './
' @@ -277,7 +276,7 @@ def _assemble_html(responses, resource, querydict): yield '
' -def _assemble_json(responses, resource): +def _assemble_json(responses, resource, url): #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. @@ -287,7 +286,9 @@ def _assemble_json(responses, resource): links = { 'self': ['{"href":"%s"}' % resource], } - if resource[-1] == '/': + if url == '/': + pass + elif resource[-1] == '/': links['collection'] = ['{"href":"%s"}' % '../'] else: links['collection'] = ['{"href":"%s"}' % './'] diff --git a/confluent/pluginapi.py b/confluent/pluginapi.py index b653218f..ecac41ba 100644 --- a/confluent/pluginapi.py +++ b/confluent/pluginapi.py @@ -176,8 +176,6 @@ def handle_path(path, operation, configmanager, inputdata=None): except IndexError: # doesn't actually have a long enough path return iterate_collections(configmanager.get_nodes()) if iscollection: - print "oh hi there..." - print repr(pathcomponents[2:]) return enumerate_node_collection(pathcomponents, configmanager) print repr(pathcomponents) del pathcomponents[0:2]