diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-01-24 23:08:09 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-01-24 23:08:09 +0000 |
| commit | 30a40db708b84b767314a9f455e68f8175f89bb2 (patch) | |
| tree | 7efd393229dbe0bc2fd49def4e50eb9b5fd38c76 /nova/api | |
| parent | 57cf8312b88852f2e1de883c4bda28f873fcde47 (diff) | |
| parent | d498aeaf61e505f2027e39406d4c60b2a50b810c (diff) | |
| download | nova-30a40db708b84b767314a9f455e68f8175f89bb2.tar.gz nova-30a40db708b84b767314a9f455e68f8175f89bb2.tar.xz nova-30a40db708b84b767314a9f455e68f8175f89bb2.zip | |
Merge "Remove unused nova/api/mapper.py"
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/mapper.py | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/nova/api/mapper.py b/nova/api/mapper.py deleted file mode 100644 index aaa59f97f..000000000 --- a/nova/api/mapper.py +++ /dev/null @@ -1,73 +0,0 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -""" -WSGI middleware for OpenStack API controllers. -""" - -import routes -import webob.dec -import webob.exc - -from nova.api.openstack import wsgi -from nova import flags -from nova import log as logging -from nova import wsgi as base_wsgi - - -LOG = logging.getLogger('nova.api.openstack.compute') -FLAGS = flags.FLAGS -flags.DEFINE_bool('allow_instance_snapshots', - True, - 'When True, this API service will permit instance snapshot operations.') - - -class FaultWrapper(base_wsgi.Middleware): - """Calls down the middleware stack, making exceptions into faults.""" - - @webob.dec.wsgify(RequestClass=wsgi.Request) - def __call__(self, req): - try: - return req.get_response(self.application) - except Exception as ex: - LOG.exception(_("Caught error: %s"), unicode(ex)) - exc = webob.exc.HTTPInternalServerError() - return wsgi.Fault(exc) - - -class APIMapper(routes.Mapper): - def routematch(self, url=None, environ=None): - if url is "": - result = self._match("", environ) - return result[0], result[1] - return routes.Mapper.routematch(self, url, environ) - - -class ProjectMapper(APIMapper): - def resource(self, member_name, collection_name, **kwargs): - if not ('parent_resource' in kwargs): - kwargs['path_prefix'] = '{project_id}/' - else: - parent_resource = kwargs['parent_resource'] - p_collection = parent_resource['collection_name'] - p_member = parent_resource['member_name'] - kwargs['path_prefix'] = '{project_id}/%s/:%s_id' % (p_collection, - p_member) - routes.Mapper.resource(self, member_name, - collection_name, - **kwargs) |
