Opened 16 years ago
Last modified 15 months ago
#7463 new defect
theme.html not included when trac is at / URL.
Reported by: | anonymous | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | next-stable-1.6.x |
Component: | general | Version: | 0.11-stable |
Severity: | normal | Keywords: | |
Cc: | ninuje@…, cmlenz@… | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
It took me 4 hours to trace all things and make out this bug. I have simple setup nothing special. When I visit http://trac.host:8000/project/ all is ok (using tracd) But when I use apache + mod_wsgi to visit http://trac.host (without project) I do not see header, banner, menu, just content. When I looked into sources I noticed that trac did not generate divs. So I started to trace it. It finished with the solution:
snowflake templates # diff layout.html layout.html-orig 54c54 < <xi:include href="$chrome.theme"></xi:include> --- > <xi:include href="$chrome.theme"><xi:fallback /></xi:include> snowflake templates #
I suppose that when fallback is ON Genshi does not search another template directories to include theme.html.
Attachments (0)
Change History (25)
comment:1 by , 16 years ago
comment:2 by , 16 years ago
Which version of Genshi are you using? Would be quite helpful to compare the results you get with the released Genshi 0.5 and latest development version (either genshi:source:branches/stable/0.5.x or genshi:source:trunk, they seem to have the same template loader code).
comment:3 by , 16 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Information requested but not provided, closing as worksforme. Feel free to reopen if you can provide the requested information.
comment:4 by , 16 years ago
Cc: | added |
---|---|
Resolution: | worksforme |
Status: | closed → reopened |
I'm having the exact same issue (using mod_wsgi with a single trac project).
This is on a fresh new x86 box, but for the record, I had the same problem with the old one ;).
Stripping the fallback tag in layout.html also 'fix' it for me.
Without this patch, I get the same behaviour with every Genshi version available (0.5.1 release, Genshi-0.5.2dev_r947, Genshi-0.6dev_r960).
It works fine with tracd.
(And it does seem to be the same issue as #7742, at least in my case).
comment:5 by , 16 years ago
Forgot to post the specs:
Gentoo ~x86, Python 2.5.2, Trac-0.11stable_r7655, Subversion 1.5.4.
Stock trac environment using SQLite.
comment:6 by , 16 years ago
Cc: | added |
---|---|
Milestone: | → 0.11.3 |
Christopher, could you confirm the need for removing the <xi:include> fallback in order to force Genshi to look in other search directories, or is it another problem?
follow-up: 8 comment:7 by , 16 years ago
Could reproduce this on an X86 - Debian/lenny Server.
Python: 2.5.2 Trac: 0.11.1 Genshi: 0.5.1 mod_wsgi: 2.3
However trac is here at /trac in an SSL subdomain
comment:8 by , 16 years ago
Replying to anonymous:
Could reproduce this on an X86 - Debian/lenny Server.
Python: 2.5.2 Trac: 0.11.1 Genshi: 0.5.1 mod_wsgi: 2.3However trac is here at /trac in an SSL subdomain
I was helping this user troubleshoot in the IRC channel. Using tracd made the problem go away, but forcing mod_wsgi into daemon mode did not. Also the issue applied to all URLs, not just the base.
follow-up: 10 comment:9 by , 15 years ago
Perhaps this is an access permission related problem?
apache requires that it has read access to the file and also that it can enter the directory which holds that file.
Perhaps changing the group ownership of the project folder to
chgrp www-data -R <project-root>
and access permission for the group to
chmod g+x,g+r -R <project-root>
with access permission for the configuration and database set to
chmod g+w <project-root>conf/trac.ini <project-root>/db/trac.db
would do the trick.
comment:10 by , 15 years ago
But then again, after rereading available comments, this would not solve it, since when removing fallback, everything seems to be working fine…
follow-up: 12 comment:11 by , 13 years ago
I seem to have this problem. I have no header on my trac page. When I was directed to this ticket by rblank on IRC, I tried the patch described in comment:1, like this:
$ diff -u /usr/local/lib/python2.6/dist-packages/Trac-0.12.2-py2.6.egg/trac/templates/layout.html.orig /usr/local/lib/python2.6/dist-packages/Trac-0.12.2-py2.6.egg/trac/templates/layout.html --- /usr/local/lib/python2.6/dist-packages/Trac-0.12.2-py2.6.egg/trac/templates/layout.html.orig 2011-10-13 05:57:06.000000000 +0000 +++ /usr/local/lib/python2.6/dist-packages/Trac-0.12.2-py2.6.egg/trac/templates/layout.html 2011-10-13 05:57:22.000000000 +0000 @@ -58,6 +58,6 @@ </div> </body></py:match> - <xi:include href="$chrome.theme"><xi:fallback /></xi:include> - <xi:include href="site.html"><xi:fallback /></xi:include> + <xi:include href="$chrome.theme"></xi:include> + <xi:include href="site.html"></xi:include> </html>
With this patch in place, when I load the front page of my trac installation, I get:
Traceback (most recent call last): File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.2-py2.6.egg/trac/web/api.py", line 440, in send_error data, 'text/html') File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.2-py2.6.egg/trac/web/chrome.py", line 836, in render_template stream = template.generate(**data) File "/usr/local/lib/python2.6/dist-packages/Genshi-0.6-py2.6.egg/genshi/template/base.py", line 532, in generate stream = self.stream File "/usr/local/lib/python2.6/dist-packages/Genshi-0.6-py2.6.egg/genshi/template/base.py", line 442, in stream self._stream = list(self._prepare(self._stream)) File "/usr/local/lib/python2.6/dist-packages/Genshi-0.6-py2.6.egg/genshi/template/base.py", line 493, in _prepare for event in tmpl.stream: File "/usr/local/lib/python2.6/dist-packages/Genshi-0.6-py2.6.egg/genshi/template/base.py", line 442, in stream self._stream = list(self._prepare(self._stream)) File "/usr/local/lib/python2.6/dist-packages/Genshi-0.6-py2.6.egg/genshi/template/base.py", line 478, in _prepare yield kind, (directives, list(substream)), pos File "/usr/local/lib/python2.6/dist-packages/Genshi-0.6-py2.6.egg/genshi/template/base.py", line 492, in _prepare cls=cls or self.__class__) File "/usr/local/lib/python2.6/dist-packages/Genshi-0.6-py2.6.egg/genshi/template/loader.py", line 246, in load raise TemplateNotFound(filename, search_path) TemplateNotFound: Template "site.html" not found
If I then install a site.html
file into the project's templates directory, I get a fully populated trac with header! (And with my site.html.)
Python: 2.6.5 Trac: 0.12.2 Genshi: 0.6 uWSGI 0.9.8.6 nginx 1.0.8
follow-up: 13 comment:12 by , 13 years ago
Replying to zooko@…:
If I then install a
site.html
file into the project's templates directory, I get a fully populated trac with header! (And with my site.html.)
What happens if you remove the <xi:fallback/>
only for $chrome.theme
(which is actually theme.html
), and remove your site.html
?
follow-up: 14 comment:13 by , 13 years ago
Replying to rblank:
Replying to zooko@…:
If I then install a
site.html
file into the project's templates directory, I get a fully populated trac with header! (And with my site.html.)What happens if you remove the
<xi:fallback/>
only for$chrome.theme
(which is actuallytheme.html
), and remove yoursite.html
?
I've now done that and my site still works fine.
comment:14 by , 13 years ago
Replying to anonymous:
Replying to rblank:
Replying to zooko@…:
If I then install a
site.html
file into the project's templates directory, I get a fully populated trac with header! (And with my site.html.)What happens if you remove the
<xi:fallback/>
only for$chrome.theme
(which is actuallytheme.html
), and remove yoursite.html
?I've now done that and my site still works fine.
Oh, and that was me, zooko@…, who said that.
comment:15 by , 12 years ago
I just upgraded https://Tahoe-LAFS.org from Trac-0.12.3 to Trac-0.12.5 and the header and toolbar disappeared. I ran diff of the relevant files in the two versions locally installed:
zooko@tahoe-lafs:/usr/local/lib/python2.6/dist-packages$ diff -u ./Trac-0.12.3-py2.6.egg/trac/templates/layout.html ./Trac-0.12.5-py2.6.egg/trac/templates/layout.html --- ./Trac-0.12.3-py2.6.egg/trac/templates/layout.html 2012-03-02 13:27:04.000000000 +0000 +++ ./Trac-0.12.5-py2.6.egg/trac/templates/layout.html 2013-03-31 00:42:45.000000000 +0000 @@ -12,7 +12,10 @@ </title> <meta py:if="chrome.content_type == 'text/html'" http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta py:for="meta in chrome.metas" py:attrs="meta"/> - <!--[if IE]><script type="text/javascript">window.location.hash = window.location.hash;</script><![endif]--> + <!--[if IE]><script type="text/javascript"> + if (/^#__msie303:/.test(window.location.hash)) + window.location.replace(window.location.hash.replace(/^#__msie303:/, '#')); + </script><![endif]--> <py:if test="chrome.links"> <py:for each="rel, links in chrome.links.items()"> <link rel="${rel}" py:for="link in links" py:attrs="link" /> @@ -39,7 +42,7 @@ ${select('*|text()|comment()')} <script type="text/javascript" py:if="chrome.late_links"> - <py:for each="link in chrome.late_links.get('stylesheet')"> + <py:for each="link in chrome.late_links.get('stylesheet', [])"> jQuery.loadStyleSheet("${link.href}", "${link.type}"); </py:for> </script> @@ -62,6 +65,6 @@ </div> </body></py:match> - <xi:include href="$chrome.theme"></xi:include> + <xi:include href="$chrome.theme"><xi:fallback /></xi:include> <xi:include href="site.html"><xi:fallback /></xi:include> </html>
I then edited the new file in this way:
zooko@tahoe-lafs:/usr/local/lib/python2.6/dist-packages/Trac-0.12.5-py2.6.egg/trac/templates$ diff -u layout.html.orig layout.html --- layout.html.orig 2013-03-31 01:28:30.000000000 +0000 +++ layout.html 2013-03-31 01:28:52.000000000 +0000 @@ -65,6 +65,6 @@ </div> </body></py:match> - <xi:include href="$chrome.theme"><xi:fallback /></xi:include> + <xi:include href="$chrome.theme"></xi:include> <xi:include href="site.html"><xi:fallback /></xi:include> </html>
And my header and toolbar reappeared.
comment:16 by , 12 years ago
At the request of osimons on IRC, here's the version of genshi:
pkg_resources.require('genshi') => [Genshi 0.6 (/usr/local/lib/python2.6/dist-packages/Genshi-0.6-py2.6.egg)] import genshi;print genshi => <module 'genshi' from '/usr/local/lib/python2.6/dist-packages/Genshi-0.6-py2.6.egg/genshi/__init__.pyc'> import genshi;print genshi.__version__ => 0.6
comment:17 by , 12 years ago
I also asked for you to test the latest Genshi release (0.6.1). Could you please test it and report back?
comment:18 by , 12 years ago
Potentially of interest: #565
Does anyone who experiences the issues with xi:fallback
here run with -O
, by any chance?
comment:19 by , 11 years ago
I ran into this problem just today (on the same tahoe-lafs.org trac that zooko worked on two years ago). I think upstream genshi's http://genshi.edgewall.org/ticket/565 is the root cause (an assert statement with important side-effects, which gets turned off when optimization is enabled). I observed headers and footers disappear when I ran our trac under uwsgi (which was configured with —optimize=2), but it looked fine under tracd (which probably doesn't use -O). This was using genshi-0.6.1 and trac-0.12.5.
From what I can tell, neither of the current Genshi releases (0.6.1 or 0.7.0) contain the fix. It's in their SVN trunk, and in the 0.6.x/0.7.x branches, but they haven't made a release since then. Trac-0.12.5 says "Genshi≥0.6,<0.7dev", so we'll need an 0.6.2 to satisfy our trac. (trac-1.0 might accept a genshi-0.7.1, I'm not sure).
So until Genshi has a fixed release, the workarounds are one of:
- locally patch genshi/template/markup.py as described in ticket 565
- don't use -O / —optimize when running trac
- don't use xi:fallback in templates
comment:20 by , 11 years ago
Great, thanks for confirming! We'll keep this ticket open as a pointer to #565 until the next Genshi release, and close it with a link to the fixed release.
comment:21 by , 10 years ago
Milestone: | next-minor-0.12.x → next-stable-1.0.x |
---|
comment:22 by , 10 years ago
Status: | reopened → new |
---|
comment:23 by , 8 years ago
Milestone: | next-stable-1.0.x → next-stable-1.2.x |
---|
Moved ticket assigned to next-stable-1.0.x since maintenance of 1.0.x is coming to a close. Please move the ticket back if it's critical to fix on 1.0.x.
comment:24 by , 5 years ago
Milestone: | next-stable-1.2.x → next-stable-1.4.x |
---|
Same with site.html. The file is in /path/to/project/templates, and when using tracd it's displayed. So I had to remove fallback and there. No the last 3 lines of layout.html look like: