Merge lp:~lifeless/launchpad/showtimes into lp:launchpad

Proposed by Robert Collins
Status: Merged
Approved by: Curtis Hovey
Approved revision: no longer in the source branch.
Merged at revision: 12347
Proposed branch: lp:~lifeless/launchpad/showtimes
Merge into: lp:launchpad
Diff against target: 170 lines (+52/-7)
7 files modified
lib/canonical/launchpad/icing/style-3-0.css.in (+6/-0)
lib/canonical/launchpad/pagetests/basics/user-requested-oops.txt (+6/-2)
lib/canonical/launchpad/templates/launchpad-loginstatus.pt (+1/-0)
lib/lp/app/browser/tests/base-layout.txt (+6/-4)
lib/lp/app/templates/base-layout.pt (+15/-1)
lib/lp/services/features/flags.py (+4/-0)
lib/lp/services/features/rulesource.py (+14/-0)
To merge this branch: bzr merge lp:~lifeless/launchpad/showtimes
Reviewer Review Type Date Requested Status
Curtis Hovey (community) code Approve
Review via email: mp+48754@code.launchpad.net

Commit message

[r=sinzui][bug=715474] Permit showing server side render times in the visible page (controlled by feature flag visible_render_time).

Description of the change

With thanks to Huw for the javascript, this branch adds the server render time to the left of the logged in user. Its only shown when visible_render_time is set as a feature flag : so we can set this to team:launchpad and show it just for launchpad developers.

To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote :

This is a screenshot without huw's shininess improvement. http://people.ubuntu.com/~lifeless/showtime.png

Revision history for this message
Curtis Hovey (sinzui) wrote :

We discussed the Bugtask decorated resultset changes. They are from another branch that is already approved to land, So I only reviewed the base-layout and rendertime changes. These are good to land.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/icing/style-3-0.css.in'
2--- lib/canonical/launchpad/icing/style-3-0.css.in 2011-02-03 21:08:58 +0000
3+++ lib/canonical/launchpad/icing/style-3-0.css.in 2011-02-09 05:43:36 +0000
4@@ -1162,6 +1162,12 @@
5 top: .5em;
6 right: 1.5em;
7 }
8+#rendertime {
9+ float: left;
10+ margin: 0.2em 1.2em 0 0;
11+ color: #666;
12+ font-size: 77%;
13+ }
14 div.watermark-apps-portlet {
15 clear: both;
16 margin-bottom: .5em;
17
18=== modified file 'lib/canonical/launchpad/pagetests/basics/user-requested-oops.txt'
19--- lib/canonical/launchpad/pagetests/basics/user-requested-oops.txt 2010-09-01 18:55:59 +0000
20+++ lib/canonical/launchpad/pagetests/basics/user-requested-oops.txt 2011-02-09 05:43:36 +0000
21@@ -12,21 +12,25 @@
22
23 The OOPS id is put into the comment at the end of the document.
24
25- >>> (page, summary) = browser.contents.split('</html>')
26+ >>> (page, summary) = browser.contents.split('</body>')
27 >>> print summary
28+ ...
29 <!-- ...
30 At least ... actions issued in ... seconds OOPS-...
31 <BLANKLINE>
32 r...
33 -->
34+ ...
35
36 The ++oops++ can be anywhere in the traversal.
37
38 >>> browser.open("http://launchpad.dev/gnome-terminal/++oops++/trunk")
39- >>> (page, summary) = browser.contents.split('</html>')
40+ >>> (page, summary) = browser.contents.split('</body>')
41 >>> print summary
42+ ...
43 <!-- ...
44 At least ... actions issued in ... seconds OOPS-...
45 <BLANKLINE>
46 r...
47 -->
48+ ...
49
50=== modified file 'lib/canonical/launchpad/templates/launchpad-loginstatus.pt'
51--- lib/canonical/launchpad/templates/launchpad-loginstatus.pt 2010-08-12 15:31:11 +0000
52+++ lib/canonical/launchpad/templates/launchpad-loginstatus.pt 2011-02-09 05:43:36 +0000
53@@ -9,6 +9,7 @@
54 <div id="logincontrol" tal:condition="view/logged_in">
55 <form action="+logout" method="post">
56 <input type="hidden" name="loggingout" value="1" />
57+ <div id="rendertime" tal:condition="request/features/visible_render_time">Loading... &bull;</div>
58 <a tal:replace="structure request/lp:person/fmt:name_link" /> &bull;
59 <input type="submit" name="logout" value="Log Out" />
60 </form>
61
62=== modified file 'lib/lp/app/browser/tests/base-layout.txt'
63--- lib/lp/app/browser/tests/base-layout.txt 2010-11-05 17:24:55 +0000
64+++ lib/lp/app/browser/tests/base-layout.txt 2011-02-09 05:43:36 +0000
65@@ -125,9 +125,10 @@
66 Page Diagnostics
67 ----------------
68
69-The page includes a comment after the document with diagnostic information.
70+The page includes a comment after the body with diagnostic information.
71
72- >>> print html[html.index('</html>') + 7:]
73+ >>> print html[html.index('</body>') + 7:]
74+ ...
75 <!--
76 Facet name: overview
77 Page type: locationless
78@@ -135,10 +136,11 @@
79 Has application tabs: False
80 Has side portlets: False
81 At least ... queries... issued in ... seconds
82- Features: {}
83- in scopes {}
84+ Features: {...}
85+ in scopes {...}
86 r...
87 -->
88+ ...
89
90 Page Headings
91 -------------
92
93=== modified file 'lib/lp/app/templates/base-layout.pt'
94--- lib/lp/app/templates/base-layout.pt 2010-12-13 18:04:24 +0000
95+++ lib/lp/app/templates/base-layout.pt 2011-02-09 05:43:36 +0000
96@@ -169,7 +169,6 @@
97 <metal:lp-client-cache
98 use-macro="context/@@+base-layout-macros/lp-client-cache" />
99 </body>
100-</html>
101
102 <tal:template>
103 <tal:comment
104@@ -189,4 +188,19 @@
105 r${revno}
106 --&gt;" />
107 </tal:template>
108+
109+<tal:comment
110+ tal:condition="request/features/visible_render_time"
111+ define="render_time modules/canonical.launchpad.webapp.adapter/summarize_requests;"
112+ replace='structure string:&lt;script type="text/javascript"&gt;
113+ var render_time = "${render_time} &amp;bull;";
114+ LPS.use("node", function(Y) {
115+ Y.on("domready", function() {
116+ var node = Y.one("#rendertime");
117+ node.set("innerHTML", render_time);
118+ });
119+ });
120+&lt;/script&gt;' />
121+
122+</html>
123 </metal:page>
124
125=== modified file 'lib/lp/services/features/flags.py'
126--- lib/lp/services/features/flags.py 2011-01-13 22:09:52 +0000
127+++ lib/lp/services/features/flags.py 2011-02-09 05:43:36 +0000
128@@ -40,6 +40,10 @@
129 '[on|off]',
130 'redirect to private URLs instead of proxying',
131 'off'),
132+ ('visible_render_time',
133+ 'empty|nonempty',
134+ 'enables showing the page render overheads in the login widget',
135+ ''),
136 ])
137
138 # The set of all flag names that are documented.
139
140=== modified file 'lib/lp/services/features/rulesource.py'
141--- lib/lp/services/features/rulesource.py 2011-01-05 21:15:31 +0000
142+++ lib/lp/services/features/rulesource.py 2011-02-09 05:43:36 +0000
143@@ -16,6 +16,7 @@
144
145 from storm.locals import Desc
146
147+from canonical.launchpad.webapp import adapter
148 from lp.services.features.model import (
149 FeatureFlag,
150 getFeatureStore,
151@@ -90,6 +91,19 @@
152 """
153
154 def getAllRulesAsTuples(self):
155+ try:
156+ # This LBYL may look odd but it is needed. Rendering OOPSes and
157+ # timeouts also looks up flags, but doing such a lookup can
158+ # will cause a doom if the db request is not executed or is
159+ # canceled by the DB - and then results in a failure in
160+ # zope.app.publications.ZopePublication.handleError when it
161+ # calls transaction.commit.
162+ # By Looking this up first, we avoid this and also permit
163+ # code using flags to work in timed out requests (by appearing to
164+ # have no rules).
165+ adapter.get_request_remaining_seconds()
166+ except adapter.RequestExpired:
167+ return
168 store = getFeatureStore()
169 rs = (store
170 .find(FeatureFlag)