Edgewall Software
Modify

Opened 11 years ago

Closed 10 years ago

Last modified 10 years ago

#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)

CustomTemplates.png (75.9 KB ) - added by Ryan J Ollos 10 years ago.
20141209T091755.png (39.2 KB ) - added by Ryan J Ollos 10 years ago.

Download all attachments as: .zip

Change History (19)

comment:1 by lkraav <leho@…>, 11 years ago

Cc: leho@… added

comment:2 by Jun Omae, 11 years ago

Another idea is adding Installed Templates information to the About Trac page and the error page.

comment:3 by Ryan J Ollos, 11 years ago

Milestone: undecided1.0.3

by Ryan J Ollos, 10 years ago

Attachment: CustomTemplates.png added

comment:4 by Ryan J Ollos, 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 Jun Omae, 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 Ryan J Ollos, 10 years ago

Owner: set to Ryan J Ollos
Status: newassigned

by Ryan J Ollos, 10 years ago

Attachment: 20141209T091755.png added

comment:7 by Ryan J Ollos, 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.

Last edited 10 years ago by Ryan J Ollos (previous) (diff)

in reply to:  7 comment:8 by Jun Omae, 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 Ryan J Ollos, 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.

comment:10 by Ryan J Ollos, 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.

Last edited 10 years ago by Ryan J Ollos (previous) (diff)

in reply to:  10 comment:11 by Ryan J Ollos, 10 years ago

Replying to rjollos:

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.

Change committed to 1.0-stable in [13536], merged to trunk in [13537].

comment:12 by Ryan J Ollos, 10 years ago

Release Notes: modified (diff)

Extracted new method Chrome.get_interface_customization_files() in [13635]. Merged to trunk in [13636].

comment:13 by Ryan J Ollos, 10 years ago

Resolution: fixed
Status: assignedclosed

Changes to error page and semi-automated error reported on trunk in [13638].

comment:14 by Ryan J Ollos, 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.

Last edited 10 years ago by Ryan J Ollos (previous) (diff)

comment:15 by Ryan J Ollos, 10 years ago

#11925 created to deal with the regression.

comment:16 by Ryan J Ollos, 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.

in reply to:  16 comment:17 by Ryan J Ollos, 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.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.