Merge lp:~adiroiban/launchpad/bug-146178 into lp:launchpad

Proposed by Adi Roiban
Status: Merged
Approved by: Curtis Hovey
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~adiroiban/launchpad/bug-146178
Merge into: lp:launchpad
Diff against target: 469 lines (+204/-71)
5 files modified
lib/lp/registry/interfaces/distroseries.py (+12/-13)
lib/lp/translations/browser/distroseries.py (+40/-4)
lib/lp/translations/stories/distroseries/xx-distroseries-language-packs.txt (+87/-24)
lib/lp/translations/templates/distroseries-language-packs.pt (+59/-22)
lib/lp/translations/templates/distroseries-translations.pt (+6/-8)
To merge this branch: bzr merge lp:~adiroiban/launchpad/bug-146178
Reviewer Review Type Date Requested Status
Curtis Hovey (community) ui Approve
Brad Crittenden (community) code Approve
Review via email: mp+24265@code.launchpad.net

Commit message

Add in the UI +latest-delta-language-pack and +latest-full-language-pack links to retrieve latest version of language packs exports.

Description of the change

This is the resubmission of https://code.edge.launchpad.net/~adiroiban/launchpad/bug-146178/+merge/23760, since it was first targeted to db-devel.

Here is the latest diff:

=== modified file 'lib/lp/registry/interfaces/distroseries.py'
--- lib/lp/registry/interfaces/distroseries.py 2010-04-21 22:28:02 +0000
+++ lib/lp/registry/interfaces/distroseries.py 2010-04-27 22:14:46 +0000
@@ -53,7 +53,6 @@
 from lp.translations.interfaces.languagepack import ILanguagePack

-
 class DistroSeriesNameField(ContentNameField):
     """A class to ensure `IDistroSeries` has unique names."""
     errormessage = _("%s is already in use by another series.")
@@ -275,8 +274,8 @@
         title=_('Request a full language pack export'), required=True,
         description=_('''
             Whether next language pack generation will be a full export. This
- is useful when update packs are too big and want to merge all
- those changes in the base pack.
+ information is useful when update packs are too big and want to
+ merge all those changes in the base pack.
             '''))

     last_full_language_pack_exported = Object(

=== modified file 'lib/lp/translations/browser/distroseries.py'
--- lib/lp/translations/browser/distroseries.py 2010-04-21 20:52:57 +0000
+++ lib/lp/translations/browser/distroseries.py 2010-04-27 22:21:25 +0000
@@ -124,6 +124,9 @@

     @property
     def have_latest_full_pack(self):
+ """Checks if this distribution series has a full language pack newer
+ than the current one."""
+
         current = self.context.language_pack_base
         latest = self.context.last_full_language_pack_exported
         if (current is None or
@@ -135,6 +138,9 @@

     @property
     def have_latest_delta_pack(self):
+ """Checks if this distribution series has a delta language pack newer
+ than the current one."""
+
         current = self.context.language_pack_delta
         latest = self.context.last_delta_language_pack_exported
         if (current is None or

To post a comment you must log in.
Revision history for this message
Brad Crittenden (bac) :
review: Approve (code)
Revision history for this message
Curtis Hovey (sinzui) wrote :

Approved per the original review.

review: Approve (ui)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/interfaces/distroseries.py'
2--- lib/lp/registry/interfaces/distroseries.py 2010-04-08 18:40:18 +0000
3+++ lib/lp/registry/interfaces/distroseries.py 2010-04-27 22:25:48 +0000
4@@ -53,7 +53,6 @@
5 from lp.translations.interfaces.languagepack import ILanguagePack
6
7
8-
9 class DistroSeriesNameField(ContentNameField):
10 """A class to ensure `IDistroSeries` has unique names."""
11 errormessage = _("%s is already in use by another series.")
12@@ -250,33 +249,33 @@
13 language_pack_base = Choice(
14 title=_('Language pack base'), required=False,
15 description=_('''
16- Language pack export with the export of all translations available
17- for this `IDistroSeries` when it was generated. Next delta exports
18- will be generated based on this one.
19+ Language pack with the export of all translations
20+ available for this distribution series when it was generated. The
21+ subsequent update exports will be generated based on this one.
22 '''), vocabulary='FilteredFullLanguagePack')
23
24 language_pack_delta = Choice(
25- title=_('Language pack delta'), required=False,
26+ title=_('Language pack update'), required=False,
27 description=_('''
28- Language pack export with the export of all translation updates
29- available for this `IDistroSeries` since language_pack_base was
30- generated.
31+ Language pack with the export of all translation updates
32+ available for this distribution series since the language pack
33+ base was generated.
34 '''), vocabulary='FilteredDeltaLanguagePack')
35
36 language_pack_proposed = Choice(
37 title=_('Proposed language pack update'), required=False,
38 description=_('''
39- Base or delta language pack export that is being tested and
40- proposed to be used as the new language_pack_base or
41- language_pack_delta for this `IDistroSeries`.
42+ Base or update language pack export that is being tested and
43+ proposed to be used as the new language pack base or
44+ language pack update for this distribution series.
45 '''), vocabulary='FilteredLanguagePack')
46
47 language_pack_full_export_requested = Bool(
48 title=_('Request a full language pack export'), required=True,
49 description=_('''
50 Whether next language pack generation will be a full export. This
51- is useful when delta packages are too big and want to merge all
52- those changes in the base package.
53+ information is useful when update packs are too big and want to
54+ merge all those changes in the base pack.
55 '''))
56
57 last_full_language_pack_exported = Object(
58
59=== modified file 'lib/lp/translations/browser/distroseries.py'
60--- lib/lp/translations/browser/distroseries.py 2010-02-24 18:33:18 +0000
61+++ lib/lp/translations/browser/distroseries.py 2010-04-27 22:25:48 +0000
62@@ -122,6 +122,34 @@
63
64 return unused_language_packs
65
66+ @property
67+ def have_latest_full_pack(self):
68+ """Checks if this distribution series has a full language pack newer
69+ than the current one."""
70+
71+ current = self.context.language_pack_base
72+ latest = self.context.last_full_language_pack_exported
73+ if (current is None or
74+ latest is None or
75+ current.file.http_url == latest.file.http_url):
76+ return False
77+ else:
78+ return True
79+
80+ @property
81+ def have_latest_delta_pack(self):
82+ """Checks if this distribution series has a delta language pack newer
83+ than the current one."""
84+
85+ current = self.context.language_pack_delta
86+ latest = self.context.last_delta_language_pack_exported
87+ if (current is None or
88+ latest is None or
89+ current.file.http_url == latest.file.http_url):
90+ return False
91+ else:
92+ return True
93+
94 def _request_full_export(self):
95 if (self.old_request_value !=
96 self.context.language_pack_full_export_requested):
97@@ -135,9 +163,6 @@
98 "Your request has been noted. Next language pack "
99 "export will be made relative to the current base "
100 "language pack.")
101- else:
102- self.request.response.addInfoNotification(
103- "You didn't change anything.")
104
105 @action("Change Settings", condition=is_translations_admin)
106 def change_action(self, action, data):
107@@ -232,7 +257,8 @@
108 usedfor = IDistroSeries
109 facet = 'translations'
110 links = [
111- 'translations', 'templates', 'admin', 'language_packs', 'imports']
112+ 'translations', 'templates', 'admin', 'language_packs',
113+ 'latest_full_language_pack', 'latest_delta_language_pack', 'imports']
114
115 def translations(self):
116 return Link('', 'Overview')
117@@ -251,6 +277,16 @@
118 def language_packs(self):
119 return Link('+language-packs', 'Language packs')
120
121+ def latest_full_language_pack(self):
122+ return Link(
123+ '+latest-full-language-pack',
124+ 'Latest full language pack')
125+
126+ def latest_delta_language_pack(self):
127+ return Link(
128+ '+latest-delta-language-pack',
129+ 'Latest delta language pack')
130+
131
132 def check_distroseries_translations_viewable(distroseries):
133 """Check that these distribution series translations are visible.
134
135=== modified file 'lib/lp/translations/stories/distroseries/xx-distroseries-language-packs.txt'
136--- lib/lp/translations/stories/distroseries/xx-distroseries-language-packs.txt 2009-09-17 11:10:49 +0000
137+++ lib/lp/translations/stories/distroseries/xx-distroseries-language-packs.txt 2010-04-27 22:25:48 +0000
138@@ -1,4 +1,5 @@
139-= Distribution series language packs admin =
140+Distribution series language packs admin
141+========================================
142
143 For each distribution series, we can select several special language packs:
144
145@@ -18,57 +19,83 @@
146 ... 'http://translations.launchpad.dev/ubuntu/hoary')
147 >>> admin_browser.getLink('See all language packs').click()
148
149-Initially, there is no package selected.
150+Initially, there is no package selected and there are options for choosing a
151+base language pack.
152
153 >>> base = admin_browser.getControl('Language pack base')
154 >>> print base.displayValue
155 ['(no value)']
156- >>> delta = admin_browser.getControl('Language pack delta')
157+ >>> base.displayOptions
158+ ['(no value)', '2007-09-10 19:16:01 UTC', '2007-09-10 19:14:26 UTC']
159+ >>> delta = admin_browser.getControl('Language pack update')
160 >>> print delta.displayValue
161 ['(no value)']
162 >>> proposed = admin_browser.getControl('Proposed language pack update')
163 >>> print proposed.displayValue
164 ['(no value)']
165
166-
167- >>> base.displayOptions
168- ['(no value)', '2007-09-10 19:16:01 UTC', '2007-09-10 19:14:26 UTC']
169-
170 Let's select a base one:
171
172- >>> base.displayValue = ['2007-09-10 19:16:01 UTC']
173+ >>> base.displayValue = ['2007-09-10 19:14:26 UTC']
174 >>> admin_browser.getControl('Change').click()
175 >>> print admin_browser.url
176 http://translations.launchpad.dev/ubuntu/hoary/+language-packs
177
178-Now the admin page will show us that language pack selected.
179+Now the admin page will show us that language pack selected and a list of
180+available update packages.
181
182 >>> base = admin_browser.getControl('Language pack base')
183 >>> print base.displayValue
184- ['2007-09-10 19:16:01 UTC']
185-
186-Also, that change is shown in the public language pack listing web page:
187+ ['2007-09-10 19:14:26 UTC']
188+
189+ >>> update = admin_browser.getControl('Language pack update')
190+ >>> print update.displayValue
191+ ['(no value)']
192+ >>> update.displayOptions
193+ ['(no value)', '2007-09-10 19:15:19 UTC', '2007-09-10 19:15:01 UTC']
194+
195+Those changes are shown in the public language pack listing web page:
196
197 >>> browser.open('http://translations.launchpad.dev/ubuntu/hoary')
198 >>> browser.getLink('See all language packs').click()
199 >>> print extract_text(find_tag_by_id(browser.contents, "language_packs"))
200 A language pack...
201 Active language packs
202- Base pack: 2007-09-10 19:16:01 UTC
203- A complete set of translations for the OS.
204- Delta pack:
205- none yet
206- Translation updates, applied on top of the base pack.
207+ Base pack: 2007-09-10 19:14:26 UTC
208+ Archive containing a complete set of translations
209+ for this operating system.
210+ Update pack:
211+ no update
212+ Archive containing translation updates, applied on top of the base pack.
213+ Latest language packs
214+ Base pack:
215+ 2007-09-10 19:16:01 UTC
216+ Latest archive containing a complete set of translations
217+ for this operating system.
218+ Update pack:
219+ no update
220+ Latest archive containing translation updates,
221+ applied on top of the base pack.
222 Language pack being tested
223 No pack is being tested right now.
224 Currently unused language packs
225+ Full language pack: 2007-09-10 19:16:01 UTC
226 Delta language pack: 2007-09-10 19:15:19 UTC
227 Delta language pack: 2007-09-10 19:15:01 UTC
228- Full language pack: 2007-09-10 19:14:26 UTC
229-
230-There is also an option to set/unset whether next language pack generation is
231-a full export:
232-
233+
234+The active base language pack URL is linking to an archive, while the latest
235+URL uses '+latest-full-language-pack'.
236+
237+ >>> print browser.getLink('2007-09-10 19:14:26 UTC').url
238+ http.../71/ubuntu-hoary-translations.tar.gz
239+ >>> print browser.getLink('2007-09-10 19:16:01 UTC').url
240+ http://translations.launchpad.dev/ubuntu/hoary/+latest-full-language-pack
241+
242+An administrator can choose the current update pack and there is also an
243+option to set/unset whether next language pack generation is a full export:
244+
245+ >>> update = admin_browser.getControl('Language pack update')
246+ >>> update.displayValue = ['2007-09-10 19:15:01 UTC']
247 >>> admin_browser.getControl(
248 ... 'Request a full language pack export').selected
249 False
250@@ -88,6 +115,42 @@
251 True
252
253 There are no visible user interface changes once this flag is changed. It
254-just changes the behaviour of the language pack export, which is executed by cron,
255-it will do a full export of translations for this distro series.
256+just changes the behaviour of the language pack export, which is executed by
257+cron, it will do a full export of translations for this distro series.
258+
259+The language pack changes are visible on the public language pack page:
260+
261+ >>> browser.open(
262+ ... 'http://translations.launchpad.dev/ubuntu/hoary/+language-packs')
263+ >>> print extract_text(find_tag_by_id(browser.contents, "language_packs"))
264+ A language pack...
265+ Active language packs
266+ Base pack: 2007-09-10 19:14:26 UTC
267+ Archive containing a complete set of translations
268+ for this operating system.
269+ Update pack:
270+ 2007-09-10 19:15:01 UTC
271+ Archive containing translation updates, applied on top of the base pack.
272+ Latest language packs
273+ Base pack:
274+ 2007-09-10 19:16:01 UTC
275+ Latest archive containing a complete set of translations
276+ for this operating system.
277+ Update pack:
278+ 2007-09-10 19:15:19 UTC
279+ Latest archive containing translation updates,
280+ applied on top of the base pack.
281+ Language pack being tested
282+ No pack is being tested right now.
283+ Currently unused language packs
284+ Full language pack: 2007-09-10 19:16:01 UTC
285+ Delta language pack: 2007-09-10 19:15:19 UTC
286+
287+The active update language pack URL is linking to an archive, while the latest
288+URL uses '+latest-full-language-pack'.
289+
290+ >>> print browser.getLink('2007-09-10 19:15:01 UTC').url
291+ http.../72/ubuntu-hoary-translations-update.tar.gz
292+ >>> print browser.getLink('2007-09-10 19:15:19 UTC').url
293+ http://translations.launchpad.dev/ubuntu/hoary/+latest-delta-language-pack
294
295
296=== modified file 'lib/lp/translations/templates/distroseries-language-packs.pt'
297--- lib/lp/translations/templates/distroseries-language-packs.pt 2009-09-17 11:10:49 +0000
298+++ lib/lp/translations/templates/distroseries-language-packs.pt 2010-04-27 22:25:48 +0000
299@@ -6,14 +6,6 @@
300 metal:use-macro="view/macro:page/main_only"
301 i18n:domain="launchpad" >
302 <body>
303- <div metal:fill-slot="head_epilogue">
304- <style type="text/css">
305- h2.adminlabel {
306- margin: 1.5em 0 0 0;
307- }
308- </style>
309- </div>
310-
311 <div metal:fill-slot="main">
312 <div id="language_packs">
313
314@@ -39,41 +31,86 @@
315 </p>
316 </div>
317 <div class="yui-g">
318- <div class="yui-u first portlet">
319+ <div class="yui-u first portlet" id="active-language-packs">
320 <h2>Active language packs</h2>
321 <dl>
322 <dt>
323 Base pack:
324- <a tal:condition="context/language_pack_base"
325+ <a class="sprite download"
326+ tal:condition="context/language_pack_base"
327 tal:attributes="href context/language_pack_base/file/http_url">
328 <tal:export-date
329 replace="context/language_pack_base/date_exported/fmt:datetime" />
330- <img tal:condition="context/language_pack_base"
331- alt="download icon" src="/@@/download" />
332 </a>
333 <tal:not-export-date condition="not: context/language_pack_base">
334 none yet
335 </tal:not-export-date>
336 </dt>
337- <dd>A complete set of translations for the OS.</dd>
338+ <dd>
339+ Archive containing a complete set of translations for this
340+ operating system.
341+ </dd>
342 <dt>
343- Delta pack:
344- <a tal:condition="context/language_pack_delta"
345+ Update pack:
346+ <a class="sprite download"
347+ tal:condition="context/language_pack_delta"
348 tal:attributes="href context/language_pack_delta/file/http_url">
349 <tal:export-date
350 replace="context/language_pack_delta/date_exported/fmt:datetime" />
351- <img tal:condition="context/language_pack_delta"
352- alt="download icon" src="/@@/download" />
353 </a>
354 <tal:not-export-date condition="not: context/language_pack_delta">
355- none yet
356+ no update
357 </tal:not-export-date>
358 </dt>
359- <dd>Translation updates, applied on top of the base pack.</dd>
360+ <dd>
361+ Archive containing translation updates, applied on top of the
362+ base pack.
363+ </dd>
364 </dl>
365 </div>
366+
367 <div class="yui-u">
368- <div class="portlet">
369+ <div>
370+ <div id="latest-language-packs" class="portlet">
371+ <h2>Latest language packs</h2>
372+ <dl>
373+ <dt>
374+ Base pack:
375+ <a class="sprite download"
376+ tal:condition="view/have_latest_full_pack"
377+ tal:attributes="href context/menu:navigation/latest_full_language_pack/url">
378+ <tal:export-date
379+ replace="context/last_full_language_pack_exported/date_exported/fmt:datetime" />
380+ </a>
381+ <tal:not-export-date
382+ condition="not: view/have_latest_full_pack">
383+ none yet
384+ </tal:not-export-date>
385+ </dt>
386+ <dd>
387+ Latest archive containing a complete set of translations for
388+ this operating system.
389+ </dd>
390+ <dt>
391+ Update pack:
392+ <a class="sprite download"
393+ tal:condition="view/have_latest_delta_pack"
394+ tal:attributes="href context/menu:navigation/latest_delta_language_pack/url">
395+ <tal:export-date
396+ replace="context/last_delta_language_pack_exported/date_exported/fmt:datetime" />
397+ </a>
398+ <tal:not-export-date
399+ condition="not: view/have_latest_delta_pack">
400+ no update
401+ </tal:not-export-date>
402+ </dt>
403+ <dd>
404+ Latest archive containing translation updates, applied on top
405+ of the base pack.
406+ </dd>
407+ </dl>
408+ </div>
409+ <div id="testing-language-packs">
410 <h2>Language pack being tested</h2>
411 <dl tal:condition="context/language_pack_proposed">
412 <dt>
413@@ -96,14 +133,14 @@
414 <p tal:condition="not:context/language_pack_proposed">
415 No pack is being tested right now.
416 </p>
417+ </div>
418 </div>
419 </div>
420 </div>
421
422 <div class="yui-g">
423 <div class="yui-u first portlet" tal:condition="view/is_admin">
424- <h2 class="adminlabel"
425- tal:content="view/adminlabel">Language pack settings</h2>
426+ <h2 tal:content="view/adminlabel">Language pack settings</h2>
427 <div metal:use-macro="context/@@launchpad_form/form"> </div>
428 </div>
429 <div class="yui-u" tal:condition="view/unused_language_packs">
430
431=== modified file 'lib/lp/translations/templates/distroseries-translations.pt'
432--- lib/lp/translations/templates/distroseries-translations.pt 2009-12-16 15:21:36 +0000
433+++ lib/lp/translations/templates/distroseries-translations.pt 2010-04-27 22:25:48 +0000
434@@ -99,13 +99,12 @@
435 context/distribution/@@+language-pack-admin-info" />
436
437 <div>
438- <strong>Current base pack:</strong>
439- <a tal:condition="context/language_pack_base"
440+ <strong>Base pack:</strong>
441+ <a class="sprite download"
442+ tal:condition="context/language_pack_base"
443 tal:attributes="href context/language_pack_base/file/http_url">
444 <tal:export-date
445 replace="context/language_pack_base/date_exported/fmt:datetime" />
446- <img tal:condition="context/language_pack_base"
447- alt="download icon" src="/@@/download" />
448 </a>
449 <tal:not-export-date condition="not: context/language_pack_base">
450 none yet
451@@ -113,15 +112,14 @@
452 </div>
453 <div>
454 <strong>Update pack:</strong>
455- <a tal:condition="context/language_pack_delta"
456+ <a class="sprite download"
457+ tal:condition="context/language_pack_delta"
458 tal:attributes="href context/language_pack_delta/file/http_url">
459 <tal:export-date
460 replace="context/language_pack_delta/date_exported/fmt:datetime" />
461- <img tal:condition="context/language_pack_delta"
462- alt="download icon" src="/@@/download" />
463 </a>
464 <tal:not-export-date condition="not: context/language_pack_delta">
465- none yet
466+ no update
467 </tal:not-export-date>
468 </div>
469 <p>