because the value of key in config file (trac.ini) will all be turned to lower case by system, so if any capital letter in url-regex (as key) settings will lost its meaning, following is my quick fix (also fix the class name issue, BTW):
Index: 0.11/addstaticresourcesplugin/api.py
===================================================================
--- 0.11/addstaticresourcesplugin/api.py (revision 8215)
+++ 0.11/addstaticresourcesplugin/api.py (working copy)
@@ -8,7 +8,7 @@
def urljoin(*args):
return '/'.join([i.strip('/') for i in args])
-class AddStaticResourcesComponent (Component):
+class AddStaticResourceComponent (Component):
implements (IRequestFilter, ITemplateProvider)
# IRequestHandler methods
def pre_process_request(self, req, handler):
@@ -24,10 +24,12 @@
self.log.debug("AddStaticResourceComponent: about to add resources, %s ,%s"%(req, handler))
c = self.env.config
resources = c.options(srkey)
- for regex, value in resources:
+ for key, value in resources:
+ map = value.split(' ')
+ regex = map[0]
+ paths = map[1:]
self.log.debug("AddStaticResourceComponent: Regex:'%s' matched:%s" %(regex,re.search(regex, req.path_info)))
if re.search(regex, req.path_info):
- paths = c.getlist(srkey, regex)
for p in paths:
if p.endswith("js"):
add_script(req,urljoin(srkey, p))
by this fix, url-regex is moved to value part, and key is ignored, so the config setting will like this:
[static_resources]
map1 = /wiki/SomePage list_of_files.js and_style.css