Merge lp:~ivo-kracht/launchpad/bug-999662 into lp:launchpad

Proposed by Ivo Kracht
Status: Merged
Approved by: Abel Deuring
Approved revision: no longer in the source branch.
Merged at revision: 15420
Proposed branch: lp:~ivo-kracht/launchpad/bug-999662
Merge into: lp:launchpad
Diff against target: 136 lines (+18/-23)
5 files modified
lib/lp/registry/browser/distributionsourcepackage.py (+1/-8)
lib/lp/registry/stories/packaging/xx-distributionsourcepackage-packaging.txt (+6/-6)
lib/lp/registry/stories/packaging/xx-sourcepackage-packaging.txt (+1/-1)
lib/lp/registry/templates/distributionsourcepackage-index.pt (+4/-5)
lib/lp/soyuz/stories/distribution/xx-distribution-packages.txt (+6/-3)
To merge this branch: bzr merge lp:~ivo-kracht/launchpad/bug-999662
Reviewer Review Type Date Requested Status
j.c.sackett (community) Approve
Review via email: mp+110322@code.launchpad.net

Commit message

[r=jelmer][bug=999662] Package information pages shouldn't display dates as a count of weeks

Description of the change

Fix for bug-999662

I did some changes in the distributionsourcepackage.py so that it returns the release date instead of the calculated time difference betwen the releasedate and current time. Also added the distributionsourcepackage-index.pt to properly show the releasedate and edited the related tests.

Pre-imp call with adeuring

Tests:
./bin/test registry -t xx-sourcepackage-packaging.txt
./bin/test registry xx-distributionsourcepackage-packaging.txt
./bin/test registry xx-distribution-packages.txt

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/registry/browser/distributionsourcepackage.py
  lib/lp/registry/stories/packaging/xx-distributionsourcepackage-packaging.txt
  lib/lp/registry/stories/packaging/xx-sourcepackage-packaging.txt
  lib/lp/registry/templates/distributionsourcepackage-index.pt
  lib/lp/soyuz/stories/distribution/xx-distribution-packages.txt

./lib/lp/registry/stories/packaging/xx-distributionsourcepackage-packaging.txt
      23: want exceeds 78 characters.
./lib/lp/soyuz/stories/distribution/xx-distribution-packages.txt
     226: want exceeds 78 characters.
     229: want exceeds 78 characters.
     392: narrative exceeds 78 characters.

These issues are not caused by my changes

To post a comment you must log in.
Revision history for this message
j.c.sackett (jcsackett) wrote :

Ivo--

This looks good. Thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/browser/distributionsourcepackage.py'
2--- lib/lp/registry/browser/distributionsourcepackage.py 2012-01-05 20:11:40 +0000
3+++ lib/lp/registry/browser/distributionsourcepackage.py 2012-06-14 13:07:23 +0000
4@@ -16,14 +16,12 @@
5 'DistributionSourcePackageView',
6 ]
7
8-from datetime import datetime
9 import itertools
10 import operator
11
12 from lazr.delegates import delegates
13 from lazr.restful.interfaces import IJSONRequestCache
14 from lazr.restful.utils import smartquote
15-import pytz
16 from zope.component import (
17 adapter,
18 getUtility,
19@@ -532,11 +530,6 @@
20 for version in pocket_dict:
21 most_recent_publication = pocket_dict[version][0]
22 date_published = most_recent_publication.datepublished
23- if date_published is None:
24- published_since = None
25- else:
26- now = datetime.now(tz=pytz.UTC)
27- published_since = now - date_published
28 pockets = ", ".join(
29 [pub.pocket.name for pub in pocket_dict[version]])
30 row = {
31@@ -547,7 +540,7 @@
32 'publication': most_recent_publication,
33 'pockets': pockets,
34 'component': most_recent_publication.component_name,
35- 'published_since': published_since,
36+ 'date_published': date_published,
37 }
38 rows.append(row)
39 # We need a blank row after each section, so the series
40
41=== modified file 'lib/lp/registry/stories/packaging/xx-distributionsourcepackage-packaging.txt'
42--- lib/lp/registry/stories/packaging/xx-distributionsourcepackage-packaging.txt 2011-04-11 16:00:53 +0000
43+++ lib/lp/registry/stories/packaging/xx-distributionsourcepackage-packaging.txt 2012-06-14 13:07:23 +0000
44@@ -19,10 +19,10 @@
45 >>> content = anon_browser.contents
46 >>> print extract_text(find_tag_by_id(content, 'packages_list'))
47 The Hoary Hedgehog Release (active development) Set upstream link
48- 1.0.9a-4ubuntu1 release (main) ... weeks ago
49+ 1.0.9a-4ubuntu1 release (main) 2005-09-15
50 The Warty Warthog Release (current stable release) alsa-utils trunk series
51- 1.0.8-1ubuntu1 release (main) ... weeks ago
52- 1.0.9a-4 release (main) ... weeks ago
53+ 1.0.8-1ubuntu1 release (main) 2005-09-15
54+ 1.0.9a-4 release (main) 2005-09-16
55
56
57 Delete Link Button
58@@ -59,7 +59,7 @@
59 Removed upstream association between alsa-utils trunk series and Warty.
60 >>> print extract_text(find_tag_by_id(content, 'packages_list'))
61 The Hoary Hedgehog Release (active development) Set upstream link
62- 1.0.9a-4ubuntu1 release (main) ... weeks ago
63+ 1.0.9a-4ubuntu1 release (main) 2005-09-15
64 The Warty Warthog Release (current stable release) Set upstream link
65- 1.0.8-1ubuntu1 release (main) ... weeks ago
66- 1.0.9a-4 release (main) ... weeks ago
67+ 1.0.8-1ubuntu1 release (main) 2005-09-15
68+ 1.0.9a-4 release (main) 2005-09-16
69
70=== modified file 'lib/lp/registry/stories/packaging/xx-sourcepackage-packaging.txt'
71--- lib/lp/registry/stories/packaging/xx-sourcepackage-packaging.txt 2012-05-24 21:26:57 +0000
72+++ lib/lp/registry/stories/packaging/xx-sourcepackage-packaging.txt 2012-06-14 13:07:23 +0000
73@@ -65,7 +65,7 @@
74 >>> print extract_text(find_tag_by_id(
75 ... user_browser.contents, 'packages_list'))
76 The Hoary Hedgehog Release (active development) ...
77- 0.1-2 release (main) ... weeks ago
78+ 0.1-2 release (main) 2005-08-24
79
80
81 Register a project from a source package
82
83=== modified file 'lib/lp/registry/templates/distributionsourcepackage-index.pt'
84--- lib/lp/registry/templates/distributionsourcepackage-index.pt 2012-05-31 02:20:41 +0000
85+++ lib/lp/registry/templates/distributionsourcepackage-index.pt 2012-06-14 13:07:23 +0000
86@@ -161,12 +161,11 @@
87 (<tal:component content="row/component"/>)
88 </td>
89 <td>
90- <tal:last_published condition="row/published_since">
91- <span tal:replace="row/published_since/fmt:approximateduration"/>
92- ago
93- </tal:last_published>
94+ <tal:date_published condition="row/date_published">
95+ <span tal:replace="row/date_published/fmt:date"/>
96+ </tal:date_published>
97 <tal:not_published
98- condition="not: row/published_since"
99+ condition="not: row/date_published"
100 content="string:(not published)"/>
101 </td>
102 </tr>
103
104=== modified file 'lib/lp/soyuz/stories/distribution/xx-distribution-packages.txt'
105--- lib/lp/soyuz/stories/distribution/xx-distribution-packages.txt 2012-05-31 02:20:41 +0000
106+++ lib/lp/soyuz/stories/distribution/xx-distribution-packages.txt 2012-06-14 13:07:23 +0000
107@@ -238,7 +238,7 @@
108 >>> print extract_text(find_tag_by_id(
109 ... user_browser.contents, 'packages_list'))
110 The Warty Warthog Release (current stable release) Set upstream link
111- 1.0 release (main) ... weeks ago
112+ 1.0 release (main) 2006-04-11
113
114 Each 'version' line contains an expandable row that shows more information
115 about that version. To show it, click the expander icon. If the user has
116@@ -247,7 +247,9 @@
117 >>> expander_url = find_tags_by_class(
118 ... user_browser.contents, 'expander')[0]
119 >>> print expander_url
120- <a class="expander" href="/ubuntu/+archive/primary/+sourcepub/26/+listing-archive-extra" id="pub26-expander"></a>
121+ <a class="expander"
122+ href="/ubuntu/+archive/primary/+sourcepub/26/+listing-archive-extra"
123+ id="pub26-expander"></a>
124
125 >>> browser.open(user_browser.getLink(id="pub26-expander").url)
126 >>> print extract_text(browser.contents)
127@@ -274,7 +276,8 @@
128 Component:* main
129 Architectures:* any
130 Latest upload: 1.0
131- *actual publishing details may vary in this distribution, these are just the package defaults.
132+ *actual publishing details may vary in this distribution, these are just
133+ the package defaults.
134
135 And if the source has direct packaging linkage, the upstream's description
136 is used in another section: