On Sun, Feb 14, 2016 at 2:10 PM, Vijay Varadan <[email protected]> wrote:

> Hey Ryan,
>
>
>
> Nailed it! :-D
>
>
>
> The issue was with the wsgi.conf file in /etc/apache2/mods-enabled – * 
> WSGIPythonOptimize
> 2 * was set on the server that rendered pages without headers / footers,
> but was * WSGIPythonOptimize 0 * on the 2 servers (including the new
> built-from-scratch virtual machine) where Genshi was working.
>
>
>
> It looks like the Trac / Genshi has an issue with optimizations turned on.
> The comment for this setting indicates that this might be the case:
>
>
>
>     #WSGIPythonOptimize: Enables basic Python optimisation features.
>
>     #
>
>     #Sets the level of Python compiler optimisations. The default is '0'
>
>     #which means no optimisations are applied.
>
>     #Setting the optimisation level to '1' or above will have the effect
>
>     #of enabling basic Python optimisations and changes the filename
>
>     #extension for compiled (bytecode) files from .pyc to .pyo.
>
>     #When the optimisation level is set to '2', doc strings will not be
>
>     #generated and retained. This will result in a smaller memory
> footprint,
>
>     #but may cause some Python packages which interrogate doc strings in
> some
>
>     #way to fail.
>
>
>
> I changed the setting to 0 and headers and footers began rendering once
> again.
>
>
>
> Thanks for staying with me through this. Appreciate your patience a ton.
>
>
>
> Should I edit the wiki and put in a note to indicate that when running
> Trac under WSGI, python optimizations should be turned off?
>
>
>
> Cheers,
>
> Vijay
>

Great find! Yes, please do edit the page to add your findings.

I've checked all the servers that I manage which use mod_wsgi and
WSGIPythonOptimize has the default value of 0.

It would be interesting to know if the pages render correctly wth
WSGIPythonOptimize = 1. Maybe we just need to alert users against
WSGIPythonOptimize = 2.

However, there may be another reason to avoid using WSGIPythonOptimize = 1,
which is #12004. I am not sure yet whether WSGIPythonOptimize = 1 has the
same effect as -o, but it does sound like it's the case.
http://trac.edgewall.org/ticket/12004
https://docs.python.org/2.7/using/cmdline.html?highlight=#cmdoption-O

- Ryan

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to