allura
修訂 | bc051176f22158aa816f5366cdb922222b49214a (tree) |
---|---|
時間 | 2010-06-17 04:54:13 |
作者 | Rick Copeland <rcopeland@geek...> |
Commiter | Rick Copeland |
[#592] - match URL scheme for static resources
@@ -15,7 +15,7 @@ smtp_server = localhost | ||
15 | 15 | smtp_port = 8826 |
16 | 16 | error_email_from = paste@localhost |
17 | 17 | # Used to uniquify references to static resources |
18 | -build_key=2010.06.14.0 | |
18 | +build_key=1276635823 | |
19 | 19 | |
20 | 20 | [server:main] |
21 | 21 | use = egg:Paste#http |
@@ -49,8 +49,10 @@ auth.ldap.admin_password = secret | ||
49 | 49 | # url_base is the prefix that references to the static resources should have |
50 | 50 | ew.script_name = /nf/%(build_key)s/_ew_/ |
51 | 51 | ew.url_base = /nf/%(build_key)s/_ew_/ |
52 | +# ew.url_base = ://a.fsdn.com/allura/nf/%(build_key)s/_ew_/ | |
52 | 53 | static.script_name = /nf/%(build_key)s/_static_/ |
53 | 54 | static.url_base = /nf/%(build_key)s/_static_/ |
55 | +# static.url_base = ://a.fsdn.com/allura/nf/%(build_key)s/_static_/ | |
54 | 56 | |
55 | 57 | gitweb.cgi = /usr/lib/cgi-bin/gitweb.cgi |
56 | 58 |
@@ -133,17 +133,17 @@ class Globals(object): | ||
133 | 133 | return result |
134 | 134 | |
135 | 135 | def forge_static(self, resource): |
136 | - return ''.join( | |
137 | - [ config['static.url_base'], | |
138 | - resource ]) | |
136 | + base = config['static.url_base'] | |
137 | + if base.startswith(':'): | |
138 | + base = request.scheme + base | |
139 | + return base + resource | |
139 | 140 | |
140 | 141 | def app_static(self, resource, app=None): |
142 | + base = config['static.url_base'] | |
141 | 143 | app = app or c.app |
142 | - return ''.join( | |
143 | - [ config['static.url_base'], | |
144 | - app.config.tool_name, | |
145 | - '/', | |
146 | - resource ]) | |
144 | + if base.startswith(':'): | |
145 | + base = request.scheme + base | |
146 | + return (base + app.config.tool_name + '/' + resource) | |
147 | 147 | |
148 | 148 | def set_project(self, pid): |
149 | 149 | c.project = M.Project.query.get(shortname=pid, deleted=False) |