Code review comment for lp:~henninge/launchpad/devel-710591-sharing-info-groundwork-0
- devel-710591-sharing-info-groundwork-0
- Merge into devel
Revision history for this message
Henning Eggers (henninge) wrote : | # |
1 | === modified file 'lib/lp/translations/utilities/tests/test_translation_sharing_info.py' |
2 | --- lib/lp/translations/utilities/tests/test_translation_sharing_info.py 2011-02-03 01:13:32 +0000 |
3 | +++ lib/lp/translations/utilities/tests/test_translation_sharing_info.py 2011-02-03 18:18:29 +0000 |
4 | @@ -1,8 +1,6 @@ |
5 | # Copyright 2009 Canonical Ltd. This software is licensed under the |
6 | # GNU Affero General Public License version 3 (see the file LICENSE). |
7 | |
8 | -# pylint: disable-msg=C0102 |
9 | - |
10 | __metaclass__ = type |
11 | |
12 | from canonical.testing.layers import ZopelessDatabaseLayer |
13 | @@ -219,6 +217,8 @@ |
14 | templatename=different_templatename)) |
15 | |
16 | def test_has_upstream_template_no_productseries(self): |
17 | + # Without an upstream project, no upstream templates won't be |
18 | + # available either. |
19 | distroseries, sourcepackagename = self._makeSourcePackage() |
20 | templatename = self.factory.getUniqueString() |
21 | |
22 | @@ -227,6 +227,7 @@ |
23 | distroseries, sourcepackagename, templatename)) |
24 | |
25 | def test_has_upstream_template_no_template(self): |
26 | + # No template exists on the upstream project. |
27 | distroseries, sourcepackagename = self._makeSourcePackage() |
28 | productseries = self._makeUpstreamProductSeries( |
29 | distroseries, sourcepackagename) |
30 | @@ -237,6 +238,8 @@ |
31 | distroseries, sourcepackagename, templatename)) |
32 | |
33 | def test_has_upstream_template_one_template(self): |
34 | + # There is one template on the upstream project that matches the |
35 | + # name. |
36 | distroseries, sourcepackagename = self._makeSourcePackage() |
37 | productseries = self._makeUpstreamProductSeries( |
38 | distroseries, sourcepackagename) |
39 | @@ -249,6 +252,8 @@ |
40 | distroseries, sourcepackagename, templatename)) |
41 | |
42 | def test_has_upstream_template_one_template_wrong_name(self): |
43 | + # There is one template on the upstream project but it matches not |
44 | + # the requested name. |
45 | distroseries, sourcepackagename = self._makeSourcePackage() |
46 | productseries = self._makeUpstreamProductSeries( |
47 | distroseries, sourcepackagename) |
48 | @@ -260,12 +265,15 @@ |
49 | distroseries, sourcepackagename, different_templatename)) |
50 | |
51 | def test_has_ubuntu_template_no_sourcepackage(self): |
52 | + # There is no Ubuntu source package, so no Ubuntu template can be |
53 | + # found. |
54 | productseries = self.factory.makeProductSeries() |
55 | templatename = self.factory.getUniqueString() |
56 | |
57 | self.assertFalse(has_ubuntu_template(productseries, templatename)) |
58 | |
59 | def test_has_ubuntu_template_no_template(self): |
60 | + # The Ubuntu source package has no template. |
61 | distroseries, sourcepackagename = self._makeSourcePackage() |
62 | productseries = self._makeUpstreamProductSeries( |
63 | distroseries, sourcepackagename) |
64 | @@ -274,6 +282,8 @@ |
65 | self.assertFalse(has_ubuntu_template(productseries, templatename)) |
66 | |
67 | def test_has_ubuntu_template_one_template(self): |
68 | + # There is one template on the Ubuntu source package that matches |
69 | + # the name. |
70 | distroseries, sourcepackagename = self._makeSourcePackage() |
71 | productseries = self._makeUpstreamProductSeries( |
72 | distroseries, sourcepackagename) |
73 | @@ -285,6 +295,8 @@ |
74 | self.assertTrue(has_ubuntu_template(productseries, templatename)) |
75 | |
76 | def test_has_ubuntu_template_one_template_wrong_name(self): |
77 | + # There is one template on the Ubuntu source package but it matches |
78 | + # not the requested name. |
79 | distroseries, sourcepackagename = self._makeSourcePackage() |
80 | productseries = self._makeUpstreamProductSeries( |
81 | distroseries, sourcepackagename) |
82 | |
83 | === modified file 'lib/lp/translations/utilities/translationsharinginfo.py' |
84 | --- lib/lp/translations/utilities/translationsharinginfo.py 2011-02-03 01:13:32 +0000 |
85 | +++ lib/lp/translations/utilities/translationsharinginfo.py 2011-02-03 18:35:28 +0000 |
86 | @@ -1,7 +1,23 @@ |
87 | # Copyright 2011 Canonical Ltd. This software is licensed under the |
88 | # GNU Affero General Public License version 3 (see the file LICENSE). |
89 | |
90 | -"""Provide sharing information.""" |
91 | +"""Provide sharing information. |
92 | + |
93 | +This module defines two different types of functions that provide |
94 | +information about what sharing options are available on the other side of a |
95 | +packaging link. Since they perform similar but slightly different complex |
96 | +database queries combining them in any way will usually be wrong. |
97 | + |
98 | +get_ubuntu_sharing_info and get_upstream_sharing_info will give you |
99 | +information about the source package or productseries respectively, |
100 | +combined with possibly available templates. You can restrict the search |
101 | +by specifying a template name. |
102 | + |
103 | +has_ubuntu_template and has_upstream_template make a direct search for a |
104 | +template of the given name on the other side. They do not search for |
105 | +source package or productseries but will only return True if an actual |
106 | +template exists. That is a significant difference to the get_* functions. |
107 | +""" |
108 | |
109 | __metaclass__ = type |
110 | __all__ = [ |
Thanks for the review. Please find my added comments below.