Alec and I discussed this a while ago, but I guess neither of us has had time to implement it. The procedure to isolating req.base_path should be 1. Look for a WSGI variable trac.base_url (possibly from SetEnv TRAC_BASE_URL or PythonOption TracBaseUrl). 2. Look at base_url in trac.ini. 3. Guess from the request (not an option always).
I think this covers all the use cases quite cleanly, and would greatly simplify the deployment of Trac on DreamHost-style shared servers. --Noah Emmanuel Blot wrote: > I'd like to resume this thread that has been forgotten, as I think the > "base url", python uri root and the like should be simplified before > 0.11 is delivered. > > The documentation may need to be updated so that > the base URL appears to be the single, unique location (base_url in > trac.ini). No more "UriRoot" option in Apache, for instance. > > Moreover, I'm not a big fan to hard code the base url in the trac.ini > file. At least, the "server" part of the URL. > > The rationale is that it prevents Trac from being served from several > server names, for example an installation with http://localhost, > http://a.b.c.c and http://server need to use three different Trac > engine to server the same environment, which is a bit overkill. This, > in turn, force the use of syslog for the error logger, if all the > messages are to be sent to the same file whatever the server name used > to access Trac. > > I understand though that Trac needs to know its own URL, for example > when a notification is triggered from a hook script, Trac needs to > know the URL and it can't get it from a web request. > > However, would it be possible to split the base_url option into the > server part (which is required for the notification) and the base path > part (which cannot be guessed right from the client requests, if I my > understanding is correct) ? > > Is the "server" part of base_url required for anything else than the > notification subsystem ? > > Thanks, > Manu > > > On 3/4/07, Christian Aust <[EMAIL PROTECTED]> wrote: >> Hi Manu, >> >> Am 03.03.2007 um 16:04 schrieb Emmanuel Blot: >> >>> Anyway, would it make sense to add some sanity checks to validate that >>> at least one option that defines the base URL is set; the best option >>> would be to have a single option to define the base URL, whichever the >>> way Trac is run (tracd, mod_python, CGI, etc.). >> True. I've had some issues regarding my GoogleSitemapPlugin and the >> use of different base urls, i.e. when people accessed the admin part >> of trac using https (but other pages are accessible without SSL) or >> when trac was accessed via a reverse proxy. >> >> http://trac-hacks.org/ticket/917 >> http://trac-hacks.org/ticket/919 >> http://trac-hacks.org/ticket/1009 >> >>> As a subsidiary question, what is the best way to retrieve the base >>> URL in a plugin (in Trac 0.11)? >> Some days ago, Noah told me to use req.href() or req.abs_href() for >> this, but constructing the base URL from the current request is not >> always the best solution. Regards, >> >> - Christian >> >> > >
signature.asc
Description: OpenPGP digital signature
