[Trac-tickets] [The Trac Project] #2299: patch enhancing trac for nice urls

The Trac Project noreply at edgewall.com
Wed Nov 2 17:01:07 CST 2005


#2299: patch enhancing trac for nice urls
--------------------------------+-------------------------------------------
 Reporter:  oetiker at ee.ethz.ch  |       Owner:  jonas
     Type:  enhancement         |      Status:  new  
 Priority:  normal              |   Milestone:       
Component:  general             |     Version:  0.9  
 Severity:  minor               |   Keywords:                      |  
--------------------------------+-------------------------------------------
 I am using mod_rewrite to hide the fcgi trac script ... this works fine,
 except that
 trac uses absolte urls in its generated content ... so the name of the
 fcgi script will be exposed all the same ... with this patch I can set the
 ''TRAC_BASE_URL'' environment variable to tell trac what base URL it
 should be using.

 {{{
 #!python
 --- temp/trac/trac-0.9/trac/web/cgi_frontend.py 2005-10-31
 19:37:51.000000000 +0100
 +++ pack/trac-0.9/lib/python2.3/site-packages/trac/web/cgi_frontend.py
 2005-11-02 23:30:52.393286000 +0100
 @@ -49,6 +49,10 @@
          self.args = self._getFieldStorage()

          self.cgi_location = self.__environ.get('SCRIPT_NAME')
 +
 +        if 'TRAC_BASE_URL' in os.environ:
 +            self.cgi_location = os.environ['TRAC_BASE_URL'];
 +
          self.idx_location = self.cgi_location

          self.path_info = self.__environ.get('PATH_INFO', '')
 }}}

-- 
Ticket URL: <http://projects.edgewall.com/trac/ticket/2299>
The Trac Project <http://trac.edgewall.com/>


More information about the Trac-Tickets mailing list