Merge lp:~rvb/maas/fix-doc-link into lp:~maas-committers/maas/trunk

Proposed by Raphaël Badin
Status: Merged
Approved by: Raphaël Badin
Approved revision: no longer in the source branch.
Merged at revision: 3598
Proposed branch: lp:~rvb/maas/fix-doc-link
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 56 lines (+9/-8)
2 files modified
src/maasserver/utils/tests/test_version.py (+3/-3)
src/maasserver/utils/version.py (+6/-5)
To merge this branch: bzr merge lp:~rvb/maas/fix-doc-link
Reviewer Review Type Date Requested Status
Gavin Panella (community) Approve
Review via email: mp+251719@code.launchpad.net

Commit message

Fix links to changelog and documentation: the link should contain `docs<version>` and not `doc<version>`.

To post a comment you must log in.
Revision history for this message
Gavin Panella (allenap) wrote :

Cool. One suggestion.

review: Approve
Revision history for this message
Raphaël Badin (rvb) :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/maasserver/utils/tests/test_version.py'
--- src/maasserver/utils/tests/test_version.py 2015-03-03 16:09:08 +0000
+++ src/maasserver/utils/tests/test_version.py 2015-03-04 12:34:17 +0000
@@ -181,14 +181,14 @@
181 def test__returns_doc_version_with_greater_than_1_decimals(self):181 def test__returns_doc_version_with_greater_than_1_decimals(self):
182 mock_version = self.patch(version, "get_maas_main_version")182 mock_version = self.patch(version, "get_maas_main_version")
183 mock_version.return_value = "1.8.0"183 mock_version.return_value = "1.8.0"
184 self.assertEquals("doc1.8", version.get_maas_doc_version())184 self.assertEquals("docs1.8", version.get_maas_doc_version())
185185
186 def test__returns_doc_version_with_equal_to_1_decimals(self):186 def test__returns_doc_version_with_equal_to_1_decimals(self):
187 mock_version = self.patch(version, "get_maas_main_version")187 mock_version = self.patch(version, "get_maas_main_version")
188 mock_version.return_value = "1.8"188 mock_version.return_value = "1.8"
189 self.assertEquals("doc1.8", version.get_maas_doc_version())189 self.assertEquals("docs1.8", version.get_maas_doc_version())
190190
191 def test__returns_just_doc_if_version_is_empty(self):191 def test__returns_just_doc_if_version_is_empty(self):
192 mock_version = self.patch(version, "get_maas_main_version")192 mock_version = self.patch(version, "get_maas_main_version")
193 mock_version.return_value = ""193 mock_version.return_value = ""
194 self.assertEquals("doc", version.get_maas_doc_version())194 self.assertEquals("docs", version.get_maas_doc_version())
195195
=== modified file 'src/maasserver/utils/version.py'
--- src/maasserver/utils/version.py 2015-03-03 16:09:08 +0000
+++ src/maasserver/utils/version.py 2015-03-04 12:34:17 +0000
@@ -13,6 +13,8 @@
1313
14__metaclass__ = type14__metaclass__ = type
15__all__ = [15__all__ = [
16 "get_maas_doc_version",
17 "get_maas_version",
16 ]18 ]
1719
18import apt_pkg20import apt_pkg
@@ -70,7 +72,7 @@
70 global MAAS_VERSION72 global MAAS_VERSION
71 if MAAS_VERSION is None:73 if MAAS_VERSION is None:
72 MAAS_VERSION = get_version_from_apt(REGION_PACKAGE_NAME)74 MAAS_VERSION = get_version_from_apt(REGION_PACKAGE_NAME)
73 # Possible this returned an empty string, meaning its not installed75 # Possibly this returned an empty string, meaning it's not installed
74 # and no need to call again.76 # and no need to call again.
75 if MAAS_VERSION:77 if MAAS_VERSION:
76 # It is a valid version so set the correct format.78 # It is a valid version so set the correct format.
@@ -121,9 +123,8 @@
121def get_maas_doc_version():123def get_maas_doc_version():
122 """Return the doc version for the running MAAS region."""124 """Return the doc version for the running MAAS region."""
123 main_version = get_maas_main_version()125 main_version = get_maas_main_version()
126 doc_prefix = 'docs'
124 if not main_version:127 if not main_version:
125 return "doc"128 return doc_prefix
126 if main_version.count('.') > 1:
127 return "doc%s" % '.'.join(main_version.split('.')[:2])
128 else:129 else:
129 return "doc%s" % main_version130 return doc_prefix + '.'.join(main_version.split('.')[:2])