← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/storm-datetime into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/storm-datetime into lp:launchpad.

Commit message:
Cope with versions of Storm with the fix for LP #391601 (convert datetime to date when returning from the database).

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/storm-datetime/+merge/330086

This is backward-compatible with the version of Storm we're currently running.  Actually upgrading will involve a small number of additional test fixes (https://paste.ubuntu.com/25444934/), but since those are backward-incompatible I think it's best to apply them at the same time as we upgrade Storm.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/storm-datetime into lp:launchpad.
=== modified file 'lib/lp/app/browser/configure.zcml'
--- lib/lp/app/browser/configure.zcml	2017-01-26 17:12:47 +0000
+++ lib/lp/app/browser/configure.zcml	2017-09-01 14:14:30 +0000
@@ -630,6 +630,13 @@
       />
 
   <adapter
+      for="datetime.date"
+      provides="zope.traversing.interfaces.IPathAdapter"
+      factory="lp.app.browser.tales.DateTimeFormatterAPI"
+      name="fmt"
+      />
+
+  <adapter
       for="lp.registry.interfaces.irc.IIrcID"
       provides="zope.traversing.interfaces.IPathAdapter"
       factory="lp.app.browser.tales.IRCNicknameFormatterAPI"

=== modified file 'lib/lp/app/browser/tales.py'
--- lib/lp/app/browser/tales.py	2016-12-02 12:04:11 +0000
+++ lib/lp/app/browser/tales.py	2017-09-01 14:14:30 +0000
@@ -7,6 +7,7 @@
 
 from bisect import bisect
 from datetime import (
+    date,
     datetime,
     timedelta,
     )
@@ -2172,7 +2173,12 @@
     """Adapter from datetime objects to a formatted string."""
 
     def __init__(self, datetimeobject):
-        self._datetime = datetimeobject
+        if isinstance(datetimeobject, date):
+            self._datetime = datetime(
+                datetimeobject.year, datetimeobject.month, datetimeobject.day,
+                tzinfo=pytz.timezone('UTC'))
+        else:
+            self._datetime = datetimeobject
 
     def time(self):
         if self._datetime.tzinfo:

=== modified file 'lib/lp/registry/stories/milestone/object-milestones.txt'
--- lib/lp/registry/stories/milestone/object-milestones.txt	2015-10-05 06:34:17 +0000
+++ lib/lp/registry/stories/milestone/object-milestones.txt	2017-09-01 14:14:30 +0000
@@ -281,8 +281,8 @@
 
     >>> print extract_text(find_tag_by_id(browser.contents, 'series-trunk'))
     Version                         Expected    Released              Summary
-    Mozilla Firefox 0.9.2...        Set date    Change details 2004-10-16  ...
-    Mozilla Firefox...              Set date    Change details 2004-10-16  ...
+    Mozilla Firefox 0.9.2...        Set date    Change details 2004-10-15  ...
+    Mozilla Firefox...              Set date    Change details 2004-10-15  ...
     Mozilla Firefox test-milestone  2100-08-08  Release now ...
 
     >>> browser.getLink('test-milestone').click()

=== modified file 'lib/lp/registry/stories/milestone/xx-milestone-add-and-edit.txt'
--- lib/lp/registry/stories/milestone/xx-milestone-add-and-edit.txt	2016-01-26 15:47:37 +0000
+++ lib/lp/registry/stories/milestone/xx-milestone-add-and-edit.txt	2017-09-01 14:14:30 +0000
@@ -96,7 +96,7 @@
     >>> print extract_text(find_tag_by_id(
     ...     driver_browser.contents, 'series-trunk'))
     Version                   Expected  Released                   Summary
-    Mozilla Firefox 0.9.2...  Set date  Change details 2004-10-16
+    Mozilla Firefox 0.9.2...  Set date  Change details 2004-10-15
     ...
     Mozilla Firefox 0.9.1...
     ...

=== modified file 'lib/lp/registry/stories/productrelease/xx-productrelease-basics.txt'
--- lib/lp/registry/stories/productrelease/xx-productrelease-basics.txt	2016-10-02 22:48:24 +0000
+++ lib/lp/registry/stories/productrelease/xx-productrelease-basics.txt	2017-09-01 14:14:30 +0000
@@ -33,9 +33,9 @@
     >>> other_releases = find_tag_by_id(browser.contents, 'other-releases')
     >>> print extract_text(other_releases)
     The following releases have been made for the trunk series:
-    2004-10-16 Mozilla Firefox 0.9.2 (One (secure) Tree Hill)
-    2004-10-16 Mozilla Firefox 0.9.1 (One Tree Hill (v2))
-    2004-10-16 Mozilla Firefox 0.9 (One Tree Hill)
+    2004-10-15 Mozilla Firefox 0.9.2 (One (secure) Tree Hill)
+    2004-10-15 Mozilla Firefox 0.9.1 (One Tree Hill (v2))
+    2004-10-15 Mozilla Firefox 0.9 (One Tree Hill)
 
     >>> print browser.getLink('0.9.1').url
     http://launchpad.dev/firefox/trunk/0.9.1

=== modified file 'lib/lp/registry/stories/productseries/xx-productseries-index.txt'
--- lib/lp/registry/stories/productseries/xx-productseries-index.txt	2016-01-26 15:47:37 +0000
+++ lib/lp/registry/stories/productseries/xx-productseries-index.txt	2017-09-01 14:14:30 +0000
@@ -64,7 +64,7 @@
     >>> for row in driver_rows[0:2]:
     ...     print extract_text(row)
     Version                          Expected             Released    Summary
-    Mozilla Firefox 0.9.2 "One ...   Set date Chang...    2004-10-16  ...
+    Mozilla Firefox 0.9.2 "One ...   Set date Chang...    2004-10-15  ...
 
     >>> driver_browser.getLink('Set', index=0)
     <Link ... url='http://launchpad.dev/firefox/+milestone/0.9.2/+edit'>

=== modified file 'lib/lp/registry/templates/milestone-index.pt'
--- lib/lp/registry/templates/milestone-index.pt	2015-09-10 08:25:39 +0000
+++ lib/lp/registry/templates/milestone-index.pt	2017-09-01 14:14:30 +0000
@@ -89,7 +89,7 @@
                 <dl tal:condition="not: view/release">
                   <dt>Expected:</dt>
                   <dd><span
-                    tal:attributes="title context/dateexpected/fmt:datetime"
+                    tal:attributes="title context/dateexpected/fmt:date"
                     tal:content="context/dateexpected/fmt:approximatedate" />
                     &nbsp;
                     <a tal:replace="structure milestone_menu/create_release/fmt:icon-link" />


Follow ups