Merge lp:~stevenk/launchpad/combo-url into lp:launchpad

Proposed by Steve Kowalik on 2012-01-25
Status: Superseded
Proposed branch: lp:~stevenk/launchpad/combo-url
Merge into: lp:launchpad
Diff against target: 104 lines (+22/-10)
3 files modified
Makefile (+2/-2)
lib/lp/app/templates/base-layout-macros.pt (+8/-7)
lib/lp/services/webapp/publisher.py (+12/-1)
To merge this branch: bzr merge lp:~stevenk/launchpad/combo-url
Reviewer Review Type Date Requested Status
j.c.sackett (community) 2012-01-26 Approve on 2012-01-26
Richard Harding (community) code* 2012-01-25 Approve on 2012-01-25
Review via email: mp+90093@code.launchpad.net

This proposal has been superseded by a proposal from 2012-02-02.

Description of the Change

Instead of hard-coding /+combo in the base-layout-macros, use a tal:define to include a revno in the path, just like icing does.

To post a comment you must log in.
Richard Harding (rharding) wrote :

This looks like a good change to me. We'll need to coordinate this with the updated convoy that will handle the paths with the revno in them. It's awating approval:

https://code.launchpad.net/~rharding/convoy/route_with_paths/+merge/89102

review: Approve (code*)
j.c.sackett (jcsackett) wrote :

I have nothing to add about the diff. Coordination of this does seem like the only sticking point.

review: Approve
Steve Kowalik (stevenk) wrote :

This is blocked. Somewhat. Anyway, setting to WIP.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2012-01-26 00:23:55 +0000
3+++ Makefile 2012-01-31 00:41:27 +0000
4@@ -42,7 +42,7 @@
5
6 CODEHOSTING_ROOT=/var/tmp/bazaar.launchpad.dev
7
8-CONVOY_ROOT=/var/tmp/convoy
9+CONVOY_ROOT?=/var/tmp/convoy
10
11 BZR_VERSION_INFO = bzr-version-info.py
12
13@@ -143,7 +143,7 @@
14 chmod 777 $(CODEHOSTING_ROOT)/rewrite.log
15 touch $(CODEHOSTING_ROOT)/config/launchpad-lookup.txt
16
17-build: compile apidoc jsbuild css_combine sprite_image
18+build: compile apidoc jsbuild combobuild css_combine sprite_image
19
20 # LP_SOURCEDEPS_PATH should point to the sourcecode directory, but we
21 # want the parent directory where the download-cache and eggs directory
22
23=== modified file 'lib/lp/app/templates/base-layout-macros.pt'
24--- lib/lp/app/templates/base-layout-macros.pt 2012-01-20 00:25:56 +0000
25+++ lib/lp/app/templates/base-layout-macros.pt 2012-01-31 00:41:27 +0000
26@@ -37,6 +37,7 @@
27 tal:define="
28 revno modules/lp.app.versioninfo/revno | string:unknown;
29 icingroot string:/+icing/rev${revno};
30+ combo_url view/combo_url;
31 devmode modules/lp.services.config/config/devmode;
32 yui_version view/yui_version;
33 yui_console_debug view/yui_console_debug;"
34@@ -78,20 +79,20 @@
35 tal:content="string:var cookie_scope = '${request/lp:cookie_scope}';"></script>
36
37 <tal:js-loader condition="request/features/js.combo_loader.enabled">
38- <script
39- src="/+combo/?yui/yui/yui-min.js&lp/meta.js&yui/loader/loader-min.js"></script>
40+ <script type="text/javascript"
41+ tal:attributes="src string:${combo_url}/?yui/yui/yui-min.js&lp/meta.js&yui/loader/loader-min.js"></script>
42 <script type="text/javascript" tal:content="string:
43 YUI.GlobalConfig = {
44 combine: true,
45- comboBase: '/+combo/?',
46+ comboBase: '${combo_url}/?',
47 root: 'yui/',
48 debug: ${yui_console_debug},
49 fetchCSS: false,
50 groups: {
51 lp: {
52 combine: true,
53- base: '/+combo/?lp/',
54- comboBase: '/+combo/?',
55+ base: '${combo_url}/?lp/',
56+ comboBase: '${combo_url}/?',
57 root: 'lp/',
58 // comes from including lp/meta.js
59 modules: LP_MODULES,
60@@ -99,8 +100,8 @@
61 },
62 yui2: {
63 combine: true,
64- base: '/+combo/?yui2/',
65- comboBase: '/+combo/?',
66+ base: '${combo_url}/?yui2/',
67+ comboBase: '${combo_url}/?',
68 root: 'yui2/',
69 fetchCSS: false,
70 modules: {
71
72=== modified file 'lib/lp/services/webapp/publisher.py'
73--- lib/lp/services/webapp/publisher.py 2012-01-23 04:05:17 +0000
74+++ lib/lp/services/webapp/publisher.py 2012-01-31 00:41:27 +0000
75@@ -1,4 +1,4 @@
76-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
77+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
78 # GNU Affero General Public License version 3 (see the file LICENSE).
79
80 """Publisher of objects as web pages.
81@@ -61,6 +61,7 @@
82 from zope.traversing.browser.interfaces import IAbsoluteURL
83
84 from lp.app.errors import NotFoundError
85+from lp.app.versioninfo import revno
86 from lp.layers import (
87 LaunchpadLayer,
88 setFirstLayer,
89@@ -328,6 +329,16 @@
90 from lp.services.config import config
91 return 'true' if config.devmode else 'false'
92
93+ @property
94+ def combo_url(self):
95+ """Return the URL for the combo loader."""
96+ # Circular imports, natch.
97+ from lp.services.config import config
98+ combo_url = '/+combo'
99+ if not config.devmode:
100+ combo_url += '/rev%s' % revno
101+ return combo_url
102+
103 def render(self):
104 """Return the body of the response.
105