summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2014-10-02 13:05:56 +0000
committerGerrit Code Review <review@openstack.org>2014-10-02 13:05:56 +0000
commit28f144cef8be891ae4320f60829fca8b1e032468 (patch)
tree26485feeeb3057009447576521eb31afadbfbf13 /doc
parentc55012199f1855078de617cd226dabf657f59f6c (diff)
parent0a99bf8fc3a7c17fd6bd3acf8b54a6bd550c4b08 (diff)
downloadheat-28f144cef8be891ae4320f60829fca8b1e032468.tar.gz
Merge "doc: Improve use of the support_status attribute"
Diffstat (limited to 'doc')
-rw-r--r--doc/source/ext/resources.py65
1 files changed, 41 insertions, 24 deletions
diff --git a/doc/source/ext/resources.py b/doc/source/ext/resources.py
index 6e3e51af6..27407dd74 100644
--- a/doc/source/ext/resources.py
+++ b/doc/source/ext/resources.py
@@ -27,6 +27,9 @@ from heat.engine import properties
from heat.engine import resources
from heat.engine import support
+_CODE_NAMES = {'2014.1': 'Icehouse',
+ '2014.2': 'Juno',
+ '2015.1': 'Kilo'}
global_env = environment.Environment({}, user_env=False)
@@ -56,13 +59,10 @@ class ResourcePages(Directive):
self.resource_class.attributes_schema)
if resource_class.support_status.status == support.DEPRECATED:
- sstatus = resource_class.support_status.to_dict()
- msg = _('%(status)s')
- if sstatus['message'] is not None:
- msg = _('%(status)s - %(message)s')
- para = nodes.inline('', msg % sstatus)
- warning = nodes.note('', para)
- section.append(warning)
+ para = nodes.paragraph('', self._status_str(
+ resource_class.support_status))
+ note = nodes.note('', para)
+ section.append(note)
cls_doc = pydoc.getdoc(resource_class)
if cls_doc:
@@ -70,6 +70,13 @@ class ResourcePages(Directive):
cls_nodes = core.publish_doctree(cls_doc).children
section.extend(cls_nodes)
+ if (resource_class.support_status.status == support.SUPPORTED and
+ resource_class.support_status.version is not None):
+ tag = resource_class.support_status.version.title()
+ message = (_('Available since %s.') % self._version_str(tag))
+ para = nodes.paragraph('', message)
+ section.append(para)
+
self.contribute_properties(section)
self.contribute_attributes(section)
@@ -79,6 +86,23 @@ class ResourcePages(Directive):
return content
+ def _version_str(self, version):
+ if version in _CODE_NAMES:
+ return "%(version)s (%(code)s)" % {'version': version,
+ 'code': _CODE_NAMES[version]}
+ else:
+ return version
+
+ def _status_str(self, support_status):
+ sstatus = support_status.to_dict()
+ msg = sstatus['status']
+ if sstatus['version'] is not None:
+ msg += ' since %s' % self._version_str(sstatus['version'])
+ if sstatus['message'] is not None:
+ msg += ' - %s' % sstatus['message']
+
+ return msg
+
def _section(self, parent, title, id_pattern):
id = id_pattern % self.resource_type
section = nodes.section(ids=[id])
@@ -209,18 +233,14 @@ Resources:
prop_item.append(definition)
if prop.support_status.status != support.SUPPORTED:
- sstatus = prop.support_status.to_dict()
- msg = _('%(status)s')
- if sstatus['message'] is not None:
- msg = _('%(status)s - %(message)s')
- para = nodes.inline('', msg % sstatus)
- warning = nodes.note('', para)
- definition.append(warning)
+ para = nodes.paragraph('', self._status_str(prop.support_status))
+ note = nodes.note('', para)
+ definition.append(note)
if not prop.implemented:
- para = nodes.inline('', _('Not implemented.'))
- warning = nodes.note('', para)
- definition.append(warning)
+ para = nodes.paragraph('', _('Not implemented.'))
+ note = nodes.note('', para)
+ definition.append(note)
return
if prop.description:
@@ -304,13 +324,10 @@ Resources:
prop_item.append(definition)
if prop.support_status.status != support.SUPPORTED:
- sstatus = prop.support_status.to_dict()
- msg = _('%(status)s')
- if sstatus['message'] is not None:
- msg = _('%(status)s - %(message)s')
- para = nodes.inline('', msg % sstatus)
- warning = nodes.note('', para)
- definition.append(warning)
+ para = nodes.paragraph('',
+ self._status_str(prop.support_status))
+ note = nodes.note('', para)
+ definition.append(note)
if description:
def_para = nodes.paragraph('', description)