Opened 19 years ago
Closed 19 years ago
#1908 closed defect (fixed)
add_stylesheet() should be able to handle plugin's resource
Reported by: | Owned by: | Christopher Lenz | |
---|---|---|---|
Priority: | high | Milestone: | 0.9 |
Component: | general | Version: | devel |
Severity: | normal | Keywords: | chrome |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description (last modified by )
In r2064, trac.web.chrome.add_stylesheet()
always makes a href to standard htdocs
location. So webadmin and helloworldplugin cannot
use its own css file.
Attached patch checks whether the specified stylesheet file is in trac's standard
htdocs directory.
If exist, makes href /trac/css/xxx.cs
, or /proj/chrome/css/xxx.cs
.
BTW, This means plugin cannot override existing one. Is it good?
I think it might be ok that we always make link via /proj/chrome/
…
Attachments (2)
Change History (5)
by , 19 years ago
Attachment: | chrome.py-plugin-aware-add_stylesheet.patch added |
---|
by , 19 years ago
Attachment: | chrome.py-plugin-aware-add_stylesheet-2.patch added |
---|
Replaced. Previous attachment contains unused codes for my debug, sorry
comment:1 by , 19 years ago
Milestone: | → 0.9 |
---|---|
Owner: | changed from | to
Priority: | normal → low |
Status: | new → assigned |
Note that this is only true if you have the htdocs_location
set in trac.ini. If the option is omitted or left blank, the /chrome/
path will be used for all static file URLs.
Anyway, I'm planning to improve both add_stylesheet
and the ITemplateProvider
extension point to fix this issue.
comment:3 by , 19 years ago
Priority: | low → high |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Fixed in [2133].
Now there's no longer a htdocs_location
option that gets special handling. All static resources are served by Trac unless you configure the web server otherwise, for example:
Alias /trac.cgi/chrome/common /usr/share/trac/htdocs ScriptAlias /trac.cgi /usr/share/trac/cgi-bin/trac.cgi ...
Note that the Alias
for mapping the static resources to a directory needs to be before the ScriptAlias
.
Patch of add_stylesheet() to support plugin's stylesheet