def undeploy_plugin(request): user = user_from_request(request) backend_id = request.matchdict['backend'] machine_id = request.matchdict['machine'] plugin_id = request.matchdict['plugin'] params = params_from_request(request) plugin_type = params.get('plugin_type') host = params.get('host') if plugin_type == 'python': ret = methods.undeploy_python_plugin(user, backend_id, machine_id, plugin_id, host) return ret else: raise BadRequestError("Invalid plugin_type: '%s'" % plugin_type)