summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorBrian Waldon <brian.waldon@rackspace.com>2011-05-26 15:01:24 -0400
committerBrian Waldon <brian.waldon@rackspace.com>2011-05-26 15:01:24 -0400
commit3264c18fffa26b1288fc253f2526d9a78fdc9dd4 (patch)
tree2b00bc5ecaee23085dde754c41e156038bff4523 /nova/api
parent2d834fa19078c645e3c36001b5dd34fb8e708f0a (diff)
cleaning up getattr calls with default param
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/wsgi.py16
1 files changed, 4 insertions, 12 deletions
diff --git a/nova/api/openstack/wsgi.py b/nova/api/openstack/wsgi.py
index 5577d326f..7a747842e 100644
--- a/nova/api/openstack/wsgi.py
+++ b/nova/api/openstack/wsgi.py
@@ -58,13 +58,9 @@ class Request(webob.Request):
class TextDeserializer(object):
"""Custom request body deserialization based on controller action name."""
- def deserialize(self, datastring, action=None):
+ def deserialize(self, datastring, action='default'):
"""Find local deserialization method and parse request body."""
- try:
- action_method = getattr(self, action)
- except (AttributeError, TypeError):
- action_method = self.default
-
+ action_method = getattr(self, action, self.default)
return action_method(datastring)
def default(self, datastring):
@@ -191,13 +187,9 @@ class RequestDeserializer(object):
class DictSerializer(object):
"""Custom response body serialization based on controller action name."""
- def serialize(self, data, action=None):
+ def serialize(self, data, action='default'):
"""Find local serialization method and encode response body."""
- try:
- action_method = getattr(self, action)
- except (AttributeError, TypeError):
- action_method = self.default
-
+ action_method = getattr(self, action, self.default)
return action_method(data)
def default(self, data):