diff options
| author | Brian Lamar <brian.lamar@rackspace.com> | 2011-03-17 16:26:52 -0400 |
|---|---|---|
| committer | Brian Lamar <brian.lamar@rackspace.com> | 2011-03-17 16:26:52 -0400 |
| commit | 3628f50b4ecd2db0377fd9c158248d3b7e8e98ff (patch) | |
| tree | 71ef29c69e706c5947aeeb93f0e2cbde115e1540 | |
| parent | f96dea3da633fc71f16de1bdb95e88249b316e29 (diff) | |
| download | nova-3628f50b4ecd2db0377fd9c158248d3b7e8e98ff.tar.gz nova-3628f50b4ecd2db0377fd9c158248d3b7e8e98ff.tar.xz nova-3628f50b4ecd2db0377fd9c158248d3b7e8e98ff.zip | |
Better comment for fault. Improved readability of two small sections.
| -rw-r--r-- | nova/api/openstack/faults.py | 5 | ||||
| -rw-r--r-- | nova/api/openstack/limits.py | 2 | ||||
| -rw-r--r-- | nova/tests/api/openstack/test_limits.py | 2 |
3 files changed, 6 insertions, 3 deletions
diff --git a/nova/api/openstack/faults.py b/nova/api/openstack/faults.py index ccccbd3d2..0e9c4b26f 100644 --- a/nova/api/openstack/faults.py +++ b/nova/api/openstack/faults.py @@ -91,7 +91,10 @@ class OverLimitFault(webob.exc.HTTPException): @webob.dec.wsgify(RequestClass=wsgi.Request) def __call__(self, request): - """Currently just return the wrapped exception.""" + """ + Return the wrapped exception with a serialized body conforming to our + error format. + """ serializer = wsgi.Serializer(self._serialization_metadata) content_type = request.best_match_content_type() content = serializer.serialize(self.content, content_type) diff --git a/nova/api/openstack/limits.py b/nova/api/openstack/limits.py index 1fe519f8a..efc7d193d 100644 --- a/nova/api/openstack/limits.py +++ b/nova/api/openstack/limits.py @@ -151,7 +151,7 @@ class Limit(object): water = self.water_level val = self.value - self.remaining = math.floor((cap - water) / cap * val) + self.remaining = math.floor(((cap - water) / cap) * val) self.next_request = now def _get_time(self): diff --git a/nova/tests/api/openstack/test_limits.py b/nova/tests/api/openstack/test_limits.py index d1db93a59..05cfacc60 100644 --- a/nova/tests/api/openstack/test_limits.py +++ b/nova/tests/api/openstack/test_limits.py @@ -273,7 +273,7 @@ class LimiterTest(BaseLimitTestSuite): def _check_sum(self, num, verb, url, username=None): """Check and sum results from checks.""" results = self._check(num, verb, url, username) - return sum(filter(lambda x: x != None, results)) + return sum(item for item in results if item) def test_no_delay_GET(self): """ |
