python - How do I get the remote user agent inside a Genshi template when using Trac, and WSGI? -


I'm trying to optimize some of a Trac Project Management website and have fallen into an interesting problem:

This project contains a set of images which are both SVG and PNG. SVG pictures have many advantages including a small transmitted size against many hyperlinks and PNG which is large and can link only one document.

I think it is possible to sniff out the user agent of using jQuery, after the page was loaded and PNG was replaced with the SVG version of the image, but it was replaced by PNG to all clients. is sending. I can also use PNG to Genshi SVG for all customers and then use jQuery to put PNG back, but the same problem results I can use jQuery to insert images suitable for all customers , But this is just what the customer needs to find stupid to find the server.

Is there a way I can get browser information inside a Genshi template? It's actually a bit more difficult to call for environmental variables because I'm using Tracy as WSGI. I have seen through the output of repr (locals ()) and nothing like seeing my problem solved. I also want to avoid modifying Trac source code.

itemprop = "text">

  USER_AGENT = environ.get ('HTTP_USER_AGENT', none) after 

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -