Merge lp:~sinzui/launchpad/licenses-0 into lp:launchpad/db-devel

Proposed by Curtis Hovey
Status: Merged
Approved by: Curtis Hovey
Approved revision: no longer in the source branch.
Merged at revision: 9715
Proposed branch: lp:~sinzui/launchpad/licenses-0
Merge into: lp:launchpad/db-devel
Diff against target: 258 lines (+62/-50)
5 files modified
lib/canonical/widgets/product.py (+28/-26)
lib/canonical/widgets/templates/license.pt (+2/-2)
lib/lp/registry/doc/product-widgets.txt (+12/-8)
lib/lp/registry/interfaces/product.py (+10/-3)
lib/lp/registry/windmill/tests/test_project_licenses.py (+10/-11)
To merge this branch: bzr merge lp:~sinzui/launchpad/licenses-0
Reviewer Review Type Date Requested Status
Abel Deuring (community) code Approve
Review via email: mp+33916@code.launchpad.net

Description of the change

This is my branch to add the OFL and GFDL to the recognised licenses.

    lp:~sinzui/launchpad/licenses-0
    Diff size: 259
    Launchpad bug:
          https://bugs.launchpad.net/bugs/299734
          https://bugs.launchpad.net/bugs/616229
    Test command: ./bin/test -vv \
          -t product-widgets.txt -t test_project_licenses
    Pre-implementation: ~yosch
    Target release: 10.09

Add the OFL and GFDL to the recongnised licenses
------------------------------------------------

Add the OFL and GFDL licenses to the license enums and show them in the
second block of the license widget. We are doing OFL because Mark want it.
We postponed adding GFDL (no options) until after we had a license widget
that hide the rare licenses. We do, so this is a good time to add it.

Adding enums should be trivial. It is not. I was aware that the license widget
does odd things to make the licenses appear in AJAX enabled blocked. I added
an enum to learn what would break. The javascript and windmill tests both
broke because they assume that licenses 25 and 26 are the two special
licenses :(. I decided to fix the script. Then when I was done, I decided to
add the two licenses and be done quickly. Well it was not as quick as I hoped.

Rules
-----

    * Update the JS and windmill test to use the explicit other open source
      and other proprietary. Do not guess them by they number.
    * Add the enums.
    * Include them in the second block of the license widget.

QA
--

    * Visit https://staging.launchpad.net/launchpad/+edit
    * Verify you can see OFL and GFDL listed in the second block of licenses.

Lint
----

Linting changed files:
  lib/canonical/widgets/product.py
  lib/canonical/widgets/templates/license.pt
  lib/lp/registry/doc/product-widgets.txt
  lib/lp/registry/interfaces/product.py
  lib/lp/registry/windmill/tests/test_project_licenses.py

Test
----

    * lib/lp/registry/doc/product-widgets.txt
      * It was not obvious why adding two licenses change the order of several
        licenses. The answer is that the widget is creating an order for
        3 columns, and adding 2 licenses forces some licenses to the top of
        the next column :(
    * lib/lp/registry/windmill/tests/test_project_licenses.py
      * Updated the test to explicitly locate the OTHER_OPEN_SOURCE and
        OTHER_PROPRIETARY licenses...do not assume them by their number.

Implementation
--------------

    * lib/canonical/widgets/product.py
      * Added the OFL and GFDL to the "more" section of the widget. Fixed the
        dict spacing.
    * lib/canonical/widgets/templates/license.pt
      * Updated the script to locate the OTHER_OPEN_SOURCE and
        OTHER_PROPRIETARY licenses...do not assume them by their number.
    * lib/lp/registry/interfaces/product.py
      * Added the OFL and GFDL (no options) licenses to the enums.

To post a comment you must log in.
Revision history for this message
Abel Deuring (adeuring) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/widgets/product.py'
2--- lib/canonical/widgets/product.py 2010-08-12 19:55:29 +0000
3+++ lib/canonical/widgets/product.py 2010-08-28 15:58:43 +0000
4@@ -264,33 +264,35 @@
5 allow_pending_license = False
6
7 CATEGORIES = {
8- 'AFFERO' : 'recommended',
9- 'APACHE' : 'recommended',
10- 'BSD' : 'recommended',
11- 'GNU_GPL_V2' : 'recommended',
12- 'GNU_GPL_V3' : 'recommended',
13- 'GNU_LGPL_V2_1' : 'recommended',
14- 'GNU_LGPL_V3' : 'recommended',
15- 'MIT' : 'recommended',
16- 'CC_0' : 'recommended',
17- 'ACADEMIC' : 'more',
18- 'ARTISTIC' : 'more',
19- 'ARTISTIC_2_0' : 'more',
20- 'COMMON_PUBLIC' : 'more',
21- 'ECLIPSE' : 'more',
22+ 'AFFERO': 'recommended',
23+ 'APACHE': 'recommended',
24+ 'BSD': 'recommended',
25+ 'GNU_GPL_V2': 'recommended',
26+ 'GNU_GPL_V3': 'recommended',
27+ 'GNU_LGPL_V2_1': 'recommended',
28+ 'GNU_LGPL_V3': 'recommended',
29+ 'MIT': 'recommended',
30+ 'CC_0': 'recommended',
31+ 'ACADEMIC': 'more',
32+ 'ARTISTIC': 'more',
33+ 'ARTISTIC_2_0': 'more',
34+ 'COMMON_PUBLIC': 'more',
35+ 'ECLIPSE': 'more',
36 'EDUCATIONAL_COMMUNITY': 'more',
37- 'MPL' : 'more',
38- 'OPEN_SOFTWARE' : 'more',
39- 'PHP' : 'more',
40- 'PUBLIC_DOMAIN' : 'more',
41- 'PYTHON' : 'more',
42- 'ZPL' : 'more',
43- 'CC_BY' : 'more',
44- 'CC_BY_SA' : 'more',
45- 'PERL' : 'deprecated',
46- 'OTHER_PROPRIETARY' : 'special',
47- 'OTHER_OPEN_SOURCE' : 'special',
48- 'DONT_KNOW' : 'special',
49+ 'GNU_GFDL_NO_OPTIONS': 'more',
50+ 'MPL': 'more',
51+ 'OFL': 'more',
52+ 'OPEN_SOFTWARE': 'more',
53+ 'PHP': 'more',
54+ 'PUBLIC_DOMAIN': 'more',
55+ 'PYTHON': 'more',
56+ 'ZPL': 'more',
57+ 'CC_BY': 'more',
58+ 'CC_BY_SA': 'more',
59+ 'PERL': 'deprecated',
60+ 'OTHER_PROPRIETARY': 'special',
61+ 'OTHER_OPEN_SOURCE': 'special',
62+ 'DONT_KNOW': 'special',
63 }
64
65 items_by_category = None
66
67=== modified file 'lib/canonical/widgets/templates/license.pt'
68--- lib/canonical/widgets/templates/license.pt 2010-08-10 20:02:08 +0000
69+++ lib/canonical/widgets/templates/license.pt 2010-08-28 15:58:43 +0000
70@@ -101,8 +101,8 @@
71
72 // When Other/Proprietary or Other/Open Source is chosen, the
73 // license_info widget is displayed.
74- var other_com = Y.get(Y.DOM.byId('field.licenses.25'));
75- var other_os = Y.get(Y.DOM.byId('field.licenses.26'));
76+ var other_com = Y.get('input[value=OTHER_PROPRIETARY]');
77+ var other_os = Y.get('input[value=OTHER_OPEN_SOURCE]');
78 var details = Y.get('#license-details');
79 var proprietary = Y.get('#proprietary');
80
81
82=== modified file 'lib/lp/registry/doc/product-widgets.txt'
83--- lib/lp/registry/doc/product-widgets.txt 2010-06-16 16:26:49 +0000
84+++ lib/lp/registry/doc/product-widgets.txt 2010-08-28 15:58:43 +0000
85@@ -250,7 +250,8 @@
86 >>> license_widget = LicenseWidget(licenses_field, vtype, request)
87
88 The widget has one checkbox for each license, and it also has a link to the
89-license policy. The licenses are split up into categories.
90+license policy. The licenses are split up into categories, and they are
91+presented ordered to appear in a 3 column list.
92
93 >>> from canonical.launchpad.testing.pages import find_tag_by_id
94
95@@ -268,20 +269,23 @@
96
97 >>> print extract_text(find_tag_by_id(html, 'more'))
98 Academic Free License view license
99- Creative Commons - Attribution Share Alike view license
100+ Eclipse Public License view license
101 PHP License view license
102 Artistic License 1.0 view license
103- Eclipse Public License view license
104+ Educational Community License view license
105 Public Domain view license
106 Artistic License 2.0 view license
107- Educational Community License view license
108+ GNU GFDL no options view license
109 Python License view license
110 Common Public License view license
111 Mozilla Public License view license
112 Zope Public License view license
113 Creative Commons - Attribution view license
114+ Open Font License v1.1 view license
115+ Creative Commons - Attribution Share Alike view license
116 Open Software License v 3.0 view license
117
118+
119 >>> print extract_text(find_tag_by_id(html, 'special'))
120 I don't know yet
121 Other/Proprietary
122@@ -368,10 +372,10 @@
123 ...
124 [ ] Creative Commons - No Rights Reserved ...
125 ...
126+ [ ] Creative Commons - Attribution ...
127+ ...
128 [ ] Creative Commons - Attribution Share Alike ...
129 ...
130- [ ] Creative Commons - Attribution ...
131- ...
132
133 Any of the three Creative Commons licenses can be selected.
134
135@@ -384,10 +388,10 @@
136 ...
137 [X] Creative Commons - No Rights Reserved ...
138 ...
139+ [X] Creative Commons - Attribution ...
140+ ...
141 [X] Creative Commons - Attribution Share Alike ...
142 ...
143- [X] Creative Commons - Attribution ...
144- ...
145
146 The BSD License can be selected.
147
148
149=== modified file 'lib/lp/registry/interfaces/product.py'
150--- lib/lp/registry/interfaces/product.py 2010-08-22 19:26:46 +0000
151+++ lib/lp/registry/interfaces/product.py 2010-08-28 15:58:43 +0000
152@@ -236,9 +236,10 @@
153 'ACADEMIC', 'APACHE', 'ARTISTIC', 'ARTISTIC_2_0',
154 'BSD', 'COMMON_PUBLIC',
155 'CC_BY', 'CC_BY_SA', 'CC_0', 'ECLIPSE',
156- 'EDUCATIONAL_COMMUNITY', 'AFFERO', 'GNU_GPL_V2', 'GNU_GPL_V3',
157- 'GNU_LGPL_V2_1', 'GNU_LGPL_V3', 'MIT', 'MPL', 'OPEN_SOFTWARE', 'PERL',
158- 'PHP', 'PUBLIC_DOMAIN', 'PYTHON', 'ZPL',
159+ 'EDUCATIONAL_COMMUNITY', 'AFFERO', 'GNU_GFDL_NO_OPTIONS',
160+ 'GNU_GPL_V2', 'GNU_GPL_V3', 'GNU_LGPL_V2_1', 'GNU_LGPL_V3', 'MIT',
161+ 'MPL', 'OFL', 'OPEN_SOFTWARE', 'PERL', 'PHP', 'PUBLIC_DOMAIN',
162+ 'PYTHON', 'ZPL',
163 'DONT_KNOW', 'OTHER_PROPRIETARY', 'OTHER_OPEN_SOURCE')
164
165 ACADEMIC = DBItem(
166@@ -316,6 +317,12 @@
167 CC_0 = DBItem(
168 320, 'Creative Commons - No Rights Reserved',
169 url='http://creativecommons.org/about/cc0')
170+ GNU_GFDL_NO_OPTIONS = DBItem(
171+ 330, "GNU GFDL no options",
172+ url='http://www.gnu.org/copyleft/fdl.html')
173+ OFL = DBItem(
174+ 340, "Open Font License v1.1",
175+ url='http://scripts.sil.org/OFL')
176 # This is a placeholder "license" for users who know they want something
177 # open source but haven't yet chosen a license for their project. We do
178 # not want to block them from registering their project, but this choice
179
180=== modified file 'lib/lp/registry/windmill/tests/test_project_licenses.py'
181--- lib/lp/registry/windmill/tests/test_project_licenses.py 2010-08-20 20:31:18 +0000
182+++ lib/lp/registry/windmill/tests/test_project_licenses.py 2010-08-28 15:58:43 +0000
183@@ -22,10 +22,9 @@
184 def test_project_licenses(self):
185 """Test the dynamic aspects of the project license picker."""
186 # The firefox project is as good as any.
187- self.client.open(url=u'http://launchpad.dev:8085/firefox/+edit')
188- self.client.waits.forPageLoad(timeout=u'20000')
189-
190 lpuser.SAMPLE_PERSON.ensure_login(self.client)
191+ self.client.open(url=u'http://launchpad.dev:8085/firefox/+edit')
192+ self.client.waits.forPageLoad(timeout=u'20000')
193
194 # The Recommended table is visible.
195 self.client.waits.forElementProperty(
196@@ -64,7 +63,7 @@
197 option='className|lazr-closed')
198
199 # But clicking on one of the Other/* licenses exposes it.
200- self.client.click(id='field.licenses.26')
201+ self.client.click(xpath='//input[@value = "OTHER_OPEN_SOURCE"]')
202 self.client.waits.forElementProperty(
203 id=u'license-details',
204 option='className|lazr-opened')
205@@ -75,7 +74,7 @@
206 id=u'proprietary',
207 option='className|lazr-closed')
208
209- self.client.click(id='field.licenses.25')
210+ self.client.click(xpath='//input[@value = "OTHER_PROPRIETARY"]')
211 self.client.waits.forElementProperty(
212 id=u'license-details',
213 option='className|lazr-opened')
214@@ -85,12 +84,12 @@
215
216 # Only when all Other/* items are unchecked does the details box get
217 # hidden.
218- self.client.click(id='field.licenses.26')
219+ self.client.click(xpath='//input[@value = "OTHER_OPEN_SOURCE"]')
220 self.client.waits.forElementProperty(
221 id=u'license-details',
222 option='className|lazr-opened')
223
224- self.client.click(id='field.licenses.25')
225+ self.client.click(xpath='//input[@value = "OTHER_PROPRIETARY"]')
226 self.client.waits.forElementProperty(
227 id=u'license-details',
228 option='className|lazr-closed')
229@@ -101,17 +100,17 @@
230 # Clicking on "I haven't specified..." unchecks everything and
231 # closes the details box, but leaves the sections opened.
232
233- self.client.click(id='field.licenses.25')
234+ self.client.click(xpath='//input[@value = "OTHER_PROPRIETARY"]')
235 self.client.waits.forElementProperty(
236 id=u'license-details',
237 option='className|lazr-opened')
238
239 self.client.asserts.assertChecked(
240- id=u'field.licenses.25')
241+ xpath='//input[@value = "OTHER_PROPRIETARY"]')
242
243 self.client.click(id='license_pending')
244 self.client.asserts.assertNotChecked(
245- id=u'field.licenses.25')
246+ xpath='//input[@value = "OTHER_PROPRIETARY"]')
247
248 self.client.asserts.assertProperty(
249 id=u'license-details',
250@@ -121,7 +120,7 @@
251 # time the page is visited, those sections will be open. The
252 # Recommended section is always open.
253
254- self.client.click(id='field.licenses.25')
255+ self.client.click(xpath='//input[@value = "OTHER_PROPRIETARY"]')
256 self.client.type(id='field.license_info', text='Foo bar')
257 self.client.click(id='field.licenses.3')
258 self.client.click(id='field.actions.change')

Subscribers

People subscribed via source and target branches

to status/vote changes: