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
1=== modified file 'src/maasserver/utils/tests/test_version.py'
2--- src/maasserver/utils/tests/test_version.py 2015-03-03 16:09:08 +0000
3+++ src/maasserver/utils/tests/test_version.py 2015-03-04 12:34:17 +0000
4@@ -181,14 +181,14 @@
5 def test__returns_doc_version_with_greater_than_1_decimals(self):
6 mock_version = self.patch(version, "get_maas_main_version")
7 mock_version.return_value = "1.8.0"
8- self.assertEquals("doc1.8", version.get_maas_doc_version())
9+ self.assertEquals("docs1.8", version.get_maas_doc_version())
10
11 def test__returns_doc_version_with_equal_to_1_decimals(self):
12 mock_version = self.patch(version, "get_maas_main_version")
13 mock_version.return_value = "1.8"
14- self.assertEquals("doc1.8", version.get_maas_doc_version())
15+ self.assertEquals("docs1.8", version.get_maas_doc_version())
16
17 def test__returns_just_doc_if_version_is_empty(self):
18 mock_version = self.patch(version, "get_maas_main_version")
19 mock_version.return_value = ""
20- self.assertEquals("doc", version.get_maas_doc_version())
21+ self.assertEquals("docs", version.get_maas_doc_version())
22
23=== modified file 'src/maasserver/utils/version.py'
24--- src/maasserver/utils/version.py 2015-03-03 16:09:08 +0000
25+++ src/maasserver/utils/version.py 2015-03-04 12:34:17 +0000
26@@ -13,6 +13,8 @@
27
28 __metaclass__ = type
29 __all__ = [
30+ "get_maas_doc_version",
31+ "get_maas_version",
32 ]
33
34 import apt_pkg
35@@ -70,7 +72,7 @@
36 global MAAS_VERSION
37 if MAAS_VERSION is None:
38 MAAS_VERSION = get_version_from_apt(REGION_PACKAGE_NAME)
39- # Possible this returned an empty string, meaning its not installed
40+ # Possibly this returned an empty string, meaning it's not installed
41 # and no need to call again.
42 if MAAS_VERSION:
43 # It is a valid version so set the correct format.
44@@ -121,9 +123,8 @@
45 def get_maas_doc_version():
46 """Return the doc version for the running MAAS region."""
47 main_version = get_maas_main_version()
48+ doc_prefix = 'docs'
49 if not main_version:
50- return "doc"
51- if main_version.count('.') > 1:
52- return "doc%s" % '.'.join(main_version.split('.')[:2])
53+ return doc_prefix
54 else:
55- return "doc%s" % main_version
56+ return doc_prefix + '.'.join(main_version.split('.')[:2])