summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-11-08 21:05:32 +0000
committerGerrit Code Review <review@openstack.org>2012-11-08 21:05:32 +0000
commitab9ee3d232e0000dd8b8f1d2623d8ac72a6c9247 (patch)
tree276b0fa70eed85bd21ebec88c4803de58f226ef7 /nova/api
parentfab607c72c36ace398cee817bae2525162dcb9f1 (diff)
parent8935c3bde9e9635f65522488c1aca5df5b03050d (diff)
Merge "Limit formatting routes when adding resources"
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/__init__.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/nova/api/openstack/__init__.py b/nova/api/openstack/__init__.py
index d27b018c2..67ea6e1b5 100644
--- a/nova/api/openstack/__init__.py
+++ b/nova/api/openstack/__init__.py
@@ -90,6 +90,15 @@ class APIMapper(routes.Mapper):
return result[0], result[1]
return routes.Mapper.routematch(self, url, environ)
+ def connect(self, *args, **kargs):
+ # NOTE(vish): Default the format part of a route to only accept json
+ # and xml so it doesn't eat all characters after a '.'
+ # in the url.
+ kargs.setdefault('requirements', {})
+ if not kargs['requirements'].get('format'):
+ kargs['requirements']['format'] = 'json|xml'
+ return routes.Mapper.connect(self, *args, **kargs)
+
class ProjectMapper(APIMapper):
def resource(self, member_name, collection_name, **kwargs):