#11548 closed enhancement (fixed)
Write to log when templates are discovered in the environment or inherited templates directory
Reported by: | Ryan J Ollos | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Milestone: | 1.0.3 |
Component: | general | Version: | |
Severity: | normal | Keywords: | site-customization |
Cc: | leho@… | Branch: | |
Release Notes: |
The site customization files are displayed in the Interface Customization section of the About Trac page. The customization files are also displayed in the error report 1.1.3. |
||
API Changes: | |||
Internal Changes: |
Description
We had a very long thread on trac-users this week where the issue was first that th:TracTicketTemplatesPlugin was not functioning, and we later discovered that the auto preview functionality also was not working because the auto_preview_timeout
variable was not being set in the template.
It turns out that the problem is due to layout.html
or site.html
in the environment's templates
directory. It remains to be seen what the content of those templates are, and why the user thought is was necessary to replace layout.html
.
A common first debug step is to "disable all plugins and see if the issue goes away". We often ask for the logs early on, so we can see which plugins are loading and if there are any exceptions. However, I haven't often thought to ask whether the user has any custom site templates.
It would be nice if we could write to the logs when templates are discovered in a site or inherited templates directory. Maybe this can be done at startup?
Or maybe there is a better idea so that we can get some hints in the logs that there are some custom templates present?
Attachments (2)
Change History (19)
comment:1 by , 11 years ago
Cc: | added |
---|
comment:2 by , 11 years ago
comment:3 by , 11 years ago
Milestone: | undecided → 1.0.3 |
---|
by , 10 years ago
Attachment: | CustomTemplates.png added |
---|
comment:4 by , 10 years ago
Should we list files in the site and shared htdocs directory as well?
Initial changes in log:rjollos.git:t11548.
comment:5 by , 10 years ago
How about like this?
Name | Location | Files |
---|---|---|
Shared templates directory | /var/trac/share/templates | site.1.html, site.html |
Site templates directory | /var/trac/envs/blah/htdocs | layout.html, site.html, ticket_box.html, theme.html |
IMO, I don't want to extract general word Shared
. It's difficult to translate that word without context….
comment:6 by , 10 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
by , 10 years ago
Attachment: | 20141209T091755.png added |
---|
follow-up: 8 comment:7 by , 10 years ago
Some changes based on the feedback in comment:5:
- I used the phrase Interface Customization for the heading, taken from TracInterfaceCustomization.
- CSS and JS files in the
htdocs
directory are shown. - The locations of the files aren't show because that information is available through the
[inherit]
section and environment path.
Does the table need a header for each column?
Latest changes in log:rjollos.git:t11548.1.
comment:8 by , 10 years ago
- CSS and JS files in the
htdocs
directory are shown.
I think it's good that all files in the site directory would be shown. e.g. an image file in site directory can be specified to [header_logo] src
option.
Does the table need a header for each column?
No headers look good to me.
comment:9 by , 10 years ago
Thanks for the feedback. All files in the site and shared htdocs directories will be shown now.
Committed to 1.0-stable in [13497], merged to trunk in [13498:13499]. Sorry for the ugly commit of that merge conflict. My IDE wasn't refreshing the files correctly.
We should include this info through the automated error reporting as well. I'll work on a patch for that next.
follow-up: 11 comment:10 by , 10 years ago
[13498] should have causes a test failure if we had coverage. Test coverage added in [13534:13535].
The Plugins section is hidden if there are no plugins installed. To be consistent maybe the Interface Customization section should be hidden when there are no customization files.
comment:11 by , 10 years ago
comment:12 by , 10 years ago
Release Notes: | modified (diff) |
---|
comment:13 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Changes to error page and semi-automated error reported on trunk in [13638].
comment:14 by , 10 years ago
I found the following error for the case of a non-existent htdocs
directory:
File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/Trac-1.0.3-py2.6.egg/trac/web/main.py", line 513, in _dispatch_request dispatcher.dispatch(req) File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/Trac-1.0.3-py2.6.egg/trac/web/main.py", line 222, in dispatch resp = chosen_handler.process_request(req) File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/Trac-1.0.3-py2.6.egg/trac/about.py", line 75, in process_request Chrome(self.env).get_interface_customization_files() File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/Trac-1.0.3-py2.6.egg/trac/web/chrome.py", line 1132, in get_interface_customization_files site_htdocs = sorted(os.listdir(self.env.get_htdocs_dir()))
It would be good to trap the exception and skip non-existent directories. I'll open a new ticket for the issue.
follow-up: 17 comment:16 by , 10 years ago
On trac-hacks.org the static resources are served by the Apache web server. We have a directive like the following:
Alias /chrome/site /path/to/www/htdocs/site
[trac]
htdocs_location
is left empty in trac.ini. I'm not sure there is any way we can list the files in this case.
comment:17 by , 10 years ago
Replying to rjollos:
[trac]
htdocs_location
is left empty in trac.ini. I'm not sure there is any way we can list the files in this case.
I misunderstood the purpose of the [trac]
htdocs_location
option. I think there is no problem listing the files regardless of the value of [trac]
htdocs_location
.
Another idea is adding Installed Templates information to the About Trac page and the error page.