2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-15 12:17:47 +00:00

Pave the way for things other than 'get'

This commit is contained in:
Jarrod Johnson 2013-11-02 18:57:51 -04:00
parent f3fc2ace76
commit 4ee20bafc7

View File

@ -22,6 +22,12 @@ import eventlet.wsgi
consolesessions = {}
httpsessions = {}
opmap = {
'POST': 'create',
'GET': 'retrieve',
'PUT': 'update',
'DELETE': 'delete',
}
def _sessioncleaner():
@ -193,6 +199,9 @@ def resourcehandler(env, start_response):
yield rsp
return
else:
# normal request
operation = opmap[env['REQUEST_METHOD']]
resource = '.' + env['PATH_INFO'][env['PATH_INFO'].rindex('/'):]
try:
hdlr = pluginapi.handle_path(env['PATH_INFO'], 'retrieve', cfgmgr)
except exc.NotFoundException:
@ -201,7 +210,7 @@ def resourcehandler(env, start_response):
return
start_response('200 OK', headers)
if mimetype == 'text/html':
yield '<html><body><form>'
yield '<html><body><form action="' + resource + '" method="post">'
for rsp in hdlr:
yield rsp.html()
yield '<br>'