diff --git a/confluent/httpapi.py b/confluent/httpapi.py index aec32850..4c2f8921 100644 --- a/confluent/httpapi.py +++ b/confluent/httpapi.py @@ -149,13 +149,18 @@ def _assign_consessionid(consolesession): def resourcehandler(env, start_response): """Function to handle new wsgi requests """ - authorized = _authorize_request(env) mimetype = _pick_mimetype(env) reqbody = None reqtype = None if 'CONTENT_LENGTH' in env and int(env['CONTENT_LENGTH']) > 0: reqbody = env['wsgi.input'].read(int(env['CONTENT_LENGTH'])) reqtype = env['CONTENT_TYPE'] + operation = opmap[env['REQUEST_METHOD']] + querydict = _get_query_dict(env, reqbody, reqtype) + if 'restexplorerop' in querydict: + operation = querydict['restexplorerop'] + del querydict['restexplorerop'] + authorized = _authorize_request(env) if authorized['code'] == 401: start_response('401 Authentication Required', [('Content-type', 'text/plain'), @@ -174,11 +179,6 @@ def resourcehandler(env, start_response): headers.extend(("Set-Cookie", m.OutputString()) for m in authorized['cookie'].values()) cfgmgr = authorized['cfgmgr'] - operation = opmap[env['REQUEST_METHOD']] - querydict = _get_query_dict(env, reqbody, reqtype) - if 'restexplorerop' in querydict: - operation = querydict['restexplorerop'] - del querydict['restexplorerop'] if '/console/session' in env['PATH_INFO']: #hard bake JSON into this path, do not support other incarnations prefix, _, _ = env['PATH_INFO'].partition('/console/session') @@ -279,8 +279,6 @@ def _assemble_html(responses, resource, querydict, url): yield "
" if not iscollection: yield '' - else: - yield '' def _assemble_json(responses, resource, url): diff --git a/confluent/messages.py b/confluent/messages.py index c8f3ff05..09a22905 100644 --- a/confluent/messages.py +++ b/confluent/messages.py @@ -103,9 +103,16 @@ class LinkRelation(ConfluentMessage): class ChildCollection(LinkRelation): - def __init__(self, collname): + def __init__(self, collname, candelete=False): self.rel = 'item' self.href = collname + self.candelete = candelete + + def html(self): + if self.candelete: + return '%s . . . . . . . . . . . . . . . . . . ' % (self.href, self.rel, self.href, self.href) + else: + return '%s' % (self.href, self.rel, self.href) def get_input_message(path, operation, inputdata, nodes=None): if path[0] == 'power' and path[1] == 'state' and operation != 'retrieve': diff --git a/confluent/pluginapi.py b/confluent/pluginapi.py index 31d855a1..6992dcc1 100644 --- a/confluent/pluginapi.py +++ b/confluent/pluginapi.py @@ -97,7 +97,7 @@ def iterate_collections(iterable): for coll in iterable: if coll[-1] != '/': coll = coll + '/' - yield msg.ChildCollection(coll) + yield msg.ChildCollection(coll, candelete=True) def iterate_resources(fancydict): for resource in fancydict.iterkeys():