← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Ivo Kracht has proposed merging lp:~ivo-kracht/launchpad/bug-999662 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~ivo-kracht/launchpad/bug-999662/+merge/110322

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
-- 
https://code.launchpad.net/~ivo-kracht/launchpad/bug-999662/+merge/110322
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~ivo-kracht/launchpad/bug-999662 into lp:launchpad.
=== modified file 'lib/lp/registry/browser/distributionsourcepackage.py'
--- lib/lp/registry/browser/distributionsourcepackage.py	2012-01-05 20:11:40 +0000
+++ lib/lp/registry/browser/distributionsourcepackage.py	2012-06-14 13:07:23 +0000
@@ -16,14 +16,12 @@
     'DistributionSourcePackageView',
     ]
 
-from datetime import datetime
 import itertools
 import operator
 
 from lazr.delegates import delegates
 from lazr.restful.interfaces import IJSONRequestCache
 from lazr.restful.utils import smartquote
-import pytz
 from zope.component import (
     adapter,
     getUtility,
@@ -532,11 +530,6 @@
             for version in pocket_dict:
                 most_recent_publication = pocket_dict[version][0]
                 date_published = most_recent_publication.datepublished
-                if date_published is None:
-                    published_since = None
-                else:
-                    now = datetime.now(tz=pytz.UTC)
-                    published_since = now - date_published
                 pockets = ", ".join(
                     [pub.pocket.name for pub in pocket_dict[version]])
                 row = {
@@ -547,7 +540,7 @@
                     'publication': most_recent_publication,
                     'pockets': pockets,
                     'component': most_recent_publication.component_name,
-                    'published_since': published_since,
+                    'date_published': date_published,
                     }
                 rows.append(row)
             # We need a blank row after each section, so the series

=== modified file 'lib/lp/registry/stories/packaging/xx-distributionsourcepackage-packaging.txt'
--- lib/lp/registry/stories/packaging/xx-distributionsourcepackage-packaging.txt	2011-04-11 16:00:53 +0000
+++ lib/lp/registry/stories/packaging/xx-distributionsourcepackage-packaging.txt	2012-06-14 13:07:23 +0000
@@ -19,10 +19,10 @@
     >>> content = anon_browser.contents
     >>> print extract_text(find_tag_by_id(content, 'packages_list'))
     The Hoary Hedgehog Release (active development)     Set upstream link
-      1.0.9a-4ubuntu1 release (main) ... weeks ago
+      1.0.9a-4ubuntu1 release (main) 2005-09-15
     The Warty Warthog Release (current stable release)  alsa-utils trunk series
-      1.0.8-1ubuntu1  release (main) ... weeks ago
-      1.0.9a-4        release (main) ... weeks ago
+      1.0.8-1ubuntu1  release (main) 2005-09-15
+      1.0.9a-4        release (main) 2005-09-16
 
 
 Delete Link Button
@@ -59,7 +59,7 @@
     Removed upstream association between alsa-utils trunk series and Warty.
     >>> print extract_text(find_tag_by_id(content, 'packages_list'))
     The Hoary Hedgehog Release (active development)     Set upstream link
-      1.0.9a-4ubuntu1 release (main) ... weeks ago
+      1.0.9a-4ubuntu1 release (main) 2005-09-15
     The Warty Warthog Release (current stable release)  Set upstream link
-      1.0.8-1ubuntu1  release (main) ... weeks ago
-      1.0.9a-4        release (main) ... weeks ago
+      1.0.8-1ubuntu1  release (main) 2005-09-15
+      1.0.9a-4        release (main) 2005-09-16

=== modified file 'lib/lp/registry/stories/packaging/xx-sourcepackage-packaging.txt'
--- lib/lp/registry/stories/packaging/xx-sourcepackage-packaging.txt	2012-05-24 21:26:57 +0000
+++ lib/lp/registry/stories/packaging/xx-sourcepackage-packaging.txt	2012-06-14 13:07:23 +0000
@@ -65,7 +65,7 @@
     >>> print extract_text(find_tag_by_id(
     ...     user_browser.contents, 'packages_list'))
     The Hoary Hedgehog Release (active development) ...
-      0.1-2  release (main) ... weeks ago
+      0.1-2  release (main) 2005-08-24
 
 
 Register a project from a source package

=== modified file 'lib/lp/registry/templates/distributionsourcepackage-index.pt'
--- lib/lp/registry/templates/distributionsourcepackage-index.pt	2012-05-31 02:20:41 +0000
+++ lib/lp/registry/templates/distributionsourcepackage-index.pt	2012-06-14 13:07:23 +0000
@@ -161,12 +161,11 @@
           (<tal:component content="row/component"/>)
         </td>
         <td>
-          <tal:last_published condition="row/published_since">
-            <span tal:replace="row/published_since/fmt:approximateduration"/>
-            ago
-          </tal:last_published>
+          <tal:date_published condition="row/date_published">
+            <span tal:replace="row/date_published/fmt:date"/>
+          </tal:date_published>
           <tal:not_published
-               condition="not: row/published_since"
+               condition="not: row/date_published"
                content="string:(not published)"/>
         </td>
       </tr>

=== modified file 'lib/lp/soyuz/stories/distribution/xx-distribution-packages.txt'
--- lib/lp/soyuz/stories/distribution/xx-distribution-packages.txt	2012-05-31 02:20:41 +0000
+++ lib/lp/soyuz/stories/distribution/xx-distribution-packages.txt	2012-06-14 13:07:23 +0000
@@ -238,7 +238,7 @@
     >>> print extract_text(find_tag_by_id(
     ...     user_browser.contents, 'packages_list'))
     The Warty Warthog Release (current stable release)      Set upstream link
-      1.0  release  (main)  ... weeks ago
+      1.0  release  (main)  2006-04-11
 
 Each 'version' line contains an expandable row that shows more information
 about that version.  To show it, click the expander icon.  If the user has
@@ -247,7 +247,9 @@
     >>> expander_url = find_tags_by_class(
     ...     user_browser.contents, 'expander')[0]
     >>> print expander_url
-    <a class="expander" href="/ubuntu/+archive/primary/+sourcepub/26/+listing-archive-extra" id="pub26-expander"></a>
+    <a class="expander"
+    href="/ubuntu/+archive/primary/+sourcepub/26/+listing-archive-extra"
+    id="pub26-expander"></a>
 
     >>> browser.open(user_browser.getLink(id="pub26-expander").url)
     >>> print extract_text(browser.contents)
@@ -274,7 +276,8 @@
     Component:* main
     Architectures:* any
     Latest upload: 1.0
-    *actual publishing details may vary in this distribution, these are just the package defaults.
+    *actual publishing details may vary in this distribution, these are just
+    the package defaults.
 
 And if the source has direct packaging linkage, the upstream's description
 is used in another section:


Follow ups