diff options
| author | Alex Meade <alex.meade@rackspace.com> | 2011-10-14 10:02:57 -0400 |
|---|---|---|
| committer | Alex Meade <alex.meade@rackspace.com> | 2011-10-18 12:56:38 -0400 |
| commit | 000174461a96ca70c76c8f3a85d9bf25fe673a2d (patch) | |
| tree | 1b2eee2a9e31c34a0204837f82a9cc0e584a2111 /nova/api | |
| parent | 9f8e599022c868035a38ee2143788426a1e3a146 (diff) | |
| download | nova-000174461a96ca70c76c8f3a85d9bf25fe673a2d.tar.gz nova-000174461a96ca70c76c8f3a85d9bf25fe673a2d.tar.xz nova-000174461a96ca70c76c8f3a85d9bf25fe673a2d.zip | |
Redirects requests from /v#.# to /v#.#/
Added an APIMapper to catch routemaps when the url is '' because routes.Mapper returns an error if this is the case but we want a redirect
Fixes bug 865585
Related to Routes issue: https://bitbucket.org/bbangert/routes/issue/37/mapper-and-false-url
Change-Id: I5bc7cbde25726b340e110a8e62499b47e25bc0cd
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/__init__.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/nova/api/openstack/__init__.py b/nova/api/openstack/__init__.py index 63dc4266c..9e6346bfe 100644 --- a/nova/api/openstack/__init__.py +++ b/nova/api/openstack/__init__.py @@ -66,7 +66,15 @@ class FaultWrapper(base_wsgi.Middleware): return faults.Fault(exc) -class ProjectMapper(routes.Mapper): +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): @@ -126,6 +134,8 @@ class APIRouter(base_wsgi.Router): controller=versions.create_resource(), action='show') + mapper.redirect("", "/") + mapper.resource("console", "consoles", controller=consoles.create_resource(), parent_resource=dict(member_name='server', |
