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

Proposed by Colin Watson
Status: Merged
Merged at revision: 18451
Proposed branch: lp:~cjwatson/launchpad/storm-datetime
Merge into: lp:launchpad
Diff against target: 114 lines (+22/-9)
7 files modified
lib/lp/app/browser/configure.zcml (+7/-0)
lib/lp/app/browser/tales.py (+7/-1)
lib/lp/registry/stories/milestone/object-milestones.txt (+2/-2)
lib/lp/registry/stories/milestone/xx-milestone-add-and-edit.txt (+1/-1)
lib/lp/registry/stories/productrelease/xx-productrelease-basics.txt (+3/-3)
lib/lp/registry/stories/productseries/xx-productseries-index.txt (+1/-1)
lib/lp/registry/templates/milestone-index.pt (+1/-1)
To merge this branch: bzr merge lp:~cjwatson/launchpad/storm-datetime
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+330086@code.launchpad.net

Commit message

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

Description of the change

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.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/app/browser/configure.zcml'
2--- lib/lp/app/browser/configure.zcml 2017-01-26 17:12:47 +0000
3+++ lib/lp/app/browser/configure.zcml 2017-09-01 14:14:30 +0000
4@@ -630,6 +630,13 @@
5 />
6
7 <adapter
8+ for="datetime.date"
9+ provides="zope.traversing.interfaces.IPathAdapter"
10+ factory="lp.app.browser.tales.DateTimeFormatterAPI"
11+ name="fmt"
12+ />
13+
14+ <adapter
15 for="lp.registry.interfaces.irc.IIrcID"
16 provides="zope.traversing.interfaces.IPathAdapter"
17 factory="lp.app.browser.tales.IRCNicknameFormatterAPI"
18
19=== modified file 'lib/lp/app/browser/tales.py'
20--- lib/lp/app/browser/tales.py 2016-12-02 12:04:11 +0000
21+++ lib/lp/app/browser/tales.py 2017-09-01 14:14:30 +0000
22@@ -7,6 +7,7 @@
23
24 from bisect import bisect
25 from datetime import (
26+ date,
27 datetime,
28 timedelta,
29 )
30@@ -2172,7 +2173,12 @@
31 """Adapter from datetime objects to a formatted string."""
32
33 def __init__(self, datetimeobject):
34- self._datetime = datetimeobject
35+ if isinstance(datetimeobject, date):
36+ self._datetime = datetime(
37+ datetimeobject.year, datetimeobject.month, datetimeobject.day,
38+ tzinfo=pytz.timezone('UTC'))
39+ else:
40+ self._datetime = datetimeobject
41
42 def time(self):
43 if self._datetime.tzinfo:
44
45=== modified file 'lib/lp/registry/stories/milestone/object-milestones.txt'
46--- lib/lp/registry/stories/milestone/object-milestones.txt 2015-10-05 06:34:17 +0000
47+++ lib/lp/registry/stories/milestone/object-milestones.txt 2017-09-01 14:14:30 +0000
48@@ -281,8 +281,8 @@
49
50 >>> print extract_text(find_tag_by_id(browser.contents, 'series-trunk'))
51 Version Expected Released Summary
52- Mozilla Firefox 0.9.2... Set date Change details 2004-10-16 ...
53- Mozilla Firefox... Set date Change details 2004-10-16 ...
54+ Mozilla Firefox 0.9.2... Set date Change details 2004-10-15 ...
55+ Mozilla Firefox... Set date Change details 2004-10-15 ...
56 Mozilla Firefox test-milestone 2100-08-08 Release now ...
57
58 >>> browser.getLink('test-milestone').click()
59
60=== modified file 'lib/lp/registry/stories/milestone/xx-milestone-add-and-edit.txt'
61--- lib/lp/registry/stories/milestone/xx-milestone-add-and-edit.txt 2016-01-26 15:47:37 +0000
62+++ lib/lp/registry/stories/milestone/xx-milestone-add-and-edit.txt 2017-09-01 14:14:30 +0000
63@@ -96,7 +96,7 @@
64 >>> print extract_text(find_tag_by_id(
65 ... driver_browser.contents, 'series-trunk'))
66 Version Expected Released Summary
67- Mozilla Firefox 0.9.2... Set date Change details 2004-10-16
68+ Mozilla Firefox 0.9.2... Set date Change details 2004-10-15
69 ...
70 Mozilla Firefox 0.9.1...
71 ...
72
73=== modified file 'lib/lp/registry/stories/productrelease/xx-productrelease-basics.txt'
74--- lib/lp/registry/stories/productrelease/xx-productrelease-basics.txt 2016-10-02 22:48:24 +0000
75+++ lib/lp/registry/stories/productrelease/xx-productrelease-basics.txt 2017-09-01 14:14:30 +0000
76@@ -33,9 +33,9 @@
77 >>> other_releases = find_tag_by_id(browser.contents, 'other-releases')
78 >>> print extract_text(other_releases)
79 The following releases have been made for the trunk series:
80- 2004-10-16 Mozilla Firefox 0.9.2 (One (secure) Tree Hill)
81- 2004-10-16 Mozilla Firefox 0.9.1 (One Tree Hill (v2))
82- 2004-10-16 Mozilla Firefox 0.9 (One Tree Hill)
83+ 2004-10-15 Mozilla Firefox 0.9.2 (One (secure) Tree Hill)
84+ 2004-10-15 Mozilla Firefox 0.9.1 (One Tree Hill (v2))
85+ 2004-10-15 Mozilla Firefox 0.9 (One Tree Hill)
86
87 >>> print browser.getLink('0.9.1').url
88 http://launchpad.dev/firefox/trunk/0.9.1
89
90=== modified file 'lib/lp/registry/stories/productseries/xx-productseries-index.txt'
91--- lib/lp/registry/stories/productseries/xx-productseries-index.txt 2016-01-26 15:47:37 +0000
92+++ lib/lp/registry/stories/productseries/xx-productseries-index.txt 2017-09-01 14:14:30 +0000
93@@ -64,7 +64,7 @@
94 >>> for row in driver_rows[0:2]:
95 ... print extract_text(row)
96 Version Expected Released Summary
97- Mozilla Firefox 0.9.2 "One ... Set date Chang... 2004-10-16 ...
98+ Mozilla Firefox 0.9.2 "One ... Set date Chang... 2004-10-15 ...
99
100 >>> driver_browser.getLink('Set', index=0)
101 <Link ... url='http://launchpad.dev/firefox/+milestone/0.9.2/+edit'>
102
103=== modified file 'lib/lp/registry/templates/milestone-index.pt'
104--- lib/lp/registry/templates/milestone-index.pt 2015-09-10 08:25:39 +0000
105+++ lib/lp/registry/templates/milestone-index.pt 2017-09-01 14:14:30 +0000
106@@ -89,7 +89,7 @@
107 <dl tal:condition="not: view/release">
108 <dt>Expected:</dt>
109 <dd><span
110- tal:attributes="title context/dateexpected/fmt:datetime"
111+ tal:attributes="title context/dateexpected/fmt:date"
112 tal:content="context/dateexpected/fmt:approximatedate" />
113 &nbsp;
114 <a tal:replace="structure milestone_menu/create_release/fmt:icon-link" />