Christopher Lenz wrote:
Am 24.01.2006 um 16:12 schrieb Christian Boos:
[I fixed a bit what I said before]
I should have been able to respond to that earlier, as I have the same issue in InterTrac, when I want to access a sibling environment for the first time.

I think we [should] set env.href in the Environment constructor, instead of
doing this in trac/web/main.py:

def dispatch_request(path_info, req, env):
   ...
   env.href = Href(req.cgi_location)
   env.abs_href = Href(req.base_url)

[As that's not safe because multiple requests could modify the env simultaneously]

The Href objects shouldn't even be members of the environment in the first place, but members of the request. The notification code is one of the reasons I didn't yet refactor that.

I think notifications should only be sent (or only include links) when the [trac]base_url option is set. Otherwise, the URLs used in mails depend on which host name the user is using to access Trac, which can vary if there are aliases.

What about setting the Environment href with something like:

 base_url = self.config.get('trac', 'base_url')
 self.env.href =  base_url and Href(base_url) or None

and use env.href only when we don't have a req object?
In the context of a web UI, I agree we should use req.href
(and then, I'll have some trouble in my xref branch :) ).

-- Christian

_______________________________________________
Trac-dev mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac-dev

Reply via email to