summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Lamar <brian.lamar@rackspace.com>2011-03-28 17:15:54 -0400
committerBrian Lamar <brian.lamar@rackspace.com>2011-03-28 17:15:54 -0400
commit6efd9dc30870008750c9754de4672d3eea656cce (patch)
tree7571d36c264148cdbf717bd497e6f5bda2976e2d
parent45e3deee1581580bed56d1bdfaaf9f4814fe7963 (diff)
downloadnova-6efd9dc30870008750c9754de4672d3eea656cce.tar.gz
nova-6efd9dc30870008750c9754de4672d3eea656cce.tar.xz
nova-6efd9dc30870008750c9754de4672d3eea656cce.zip
Updated docstrings to satisfy.
-rw-r--r--nova/api/openstack/views/images.py35
1 files changed, 10 insertions, 25 deletions
diff --git a/nova/api/openstack/views/images.py b/nova/api/openstack/views/images.py
index 9db73bd4b..8f5568f6c 100644
--- a/nova/api/openstack/views/images.py
+++ b/nova/api/openstack/views/images.py
@@ -19,29 +19,21 @@ import os.path
class ViewBuilder(object):
- """
- Base class for generating responses to OpenStack API requests for
- information about images.
- """
+ """Base class for generating responses to OpenStack API requests for
+ information about images."""
def __init__(self, base_url):
- """
- Initialize new `ViewBuilder`.
- """
+ """Initialize new `ViewBuilder`."""
self._url = base_url
def _format_dates(self, image):
- """
- Update all date fields to ensure standardized formatting.
- """
+ """Update all date fields to ensure standardized formatting."""
for attr in ['created_at', 'updated_at', 'deleted_at']:
if image.get(attr) is not None:
image[attr] = image[attr].strftime('%Y-%m-%dT%H:%M:%SZ')
def _format_status(self, image):
- """
- Update the status field to standardize format.
- """
+ """Update the status field to standardize format."""
status_mapping = {
'pending': 'queued',
'decrypting': 'preparing',
@@ -56,15 +48,11 @@ class ViewBuilder(object):
image['status'] = image['status'].upper()
def generate_href(self, image_id):
- """
- Return an href string pointing to this object.
- """
+ """Return an href string pointing to this object."""
return os.path.join(self._url, "images", str(image_id))
def build(self, image_obj, detail=False):
- """
- Return a standardized image structure for display by the API.
- """
+ """Return a standardized image structure for display by the API."""
properties = image_obj.get("properties", {})
self._format_dates(image_obj)
@@ -97,18 +85,15 @@ class ViewBuilder(object):
class ViewBuilderV10(ViewBuilder):
+ """OpenStack API v1.0 Image Builder"""
pass
class ViewBuilderV11(ViewBuilder):
- """
- OpenStack API v1.1 Image Builder
- """
+ """OpenStack API v1.1 Image Builder"""
def build(self, image_obj, detail=False):
- """
- Return a standardized image structure for display by the API.
- """
+ """Return a standardized image structure for display by the API."""
image = ViewBuilder.build(self, image_obj, detail)
href = self.generate_href(image_obj["id"])