How do [project] url and [trac] base_url differ?

19 views
Skip to first unread message

RjOllos

unread,
Feb 9, 2020, 9:26:39 PM2/9/20
to Trac Development
The [trac] base_url setting is used to set env.abs_hef:

Do we also need the [project] url setting? What is the use-case for which [trac] base_url and [project] url differ?

Limited uses of project_url:
./trac/env.py:    project_url = Option('project', 'url', '',
./trac/notification/mail.py:    items = [env.project_url.encode('utf-8'), targetid, to_utimestamp(time)]
./trac/notification/mail.py:        headers['X-URL'] = self.env.project_url
./trac/web/chrome.py:            'url': self.env.project_url,
./trac/wiki/formatter.py:        local_url = self.env.project_url or self.env.abs_href.base

Further, I don't see project.url used in any templates, except to set the configuration option in admin_basics.html:
./trac/admin/templates/admin_basics.html:              <input type="text" name="url" size="48" value="${project.url}" />

If both are needed, it would be good if we can document when and how the values can differ.

- Ryan

Peter Suter

unread,
Feb 10, 2020, 6:58:22 AM2/10/20
to trac...@googlegroups.com
Clearer documentation would for sure be helpful.
I don't know the use-cases either. Some long, old discussions are here:
But I have not dug through them.

Intuitively from the names I would have guessed that maybe one of them is useful in case a "project list" is used (for Multiple Trac projects).
https://trac.edgewall.org/wiki/TracInterfaceCustomization#ProjectList
But I don't use that; it's just a (probably wrong) guess.

Maybe it helps to search where [project] url first appeared? It's not quite clear but maybe in https://trac.edgewall.org/changeset/482
A hint could be the old wiki page mentioned there:
Now I suspect maybe the original idea was that project_url can be something else entirely: The "homepage" (which does not necessarily use Trac) of the entire project (which uses Trac for tickets).
Example: The Django project uses Trac for tickets at base_url = https://code.djangoproject.com/
But the homepage for the entire Django project is project_url = https://www.djangoproject.com/
(I don't know if this is the actual current or desired configuration for Django, it's just an example.)

In that case project_url should really only be used very rarely, as a link to the project's homepage (possibly unrelated to the project's Trac installation).
Also, in that case maybe support for project_url can still just be removed. Projects that really want this feature can maybe put it directly in the notification email template?


Cheers,
Peter

RjOllos

unread,
Apr 22, 2020, 1:20:16 AM4/22/20
to Trac Development


On Monday, February 10, 2020 at 3:58:22 AM UTC-8, Peter Suter wrote:
Now I suspect maybe the original idea was that project_url can be something else entirely: The "homepage" (which does not necessarily use Trac) of the entire project (which uses Trac for tickets).
Example: The Django project uses Trac for tickets at base_url = https://code.djangoproject.com/
But the homepage for the entire Django project is project_url = https://www.djangoproject.com/
(I don't know if this is the actual current or desired configuration for Django, it's just an example.)

In that case project_url should really only be used very rarely, as a link to the project's homepage (possibly unrelated to the project's Trac installation).
Also, in that case maybe support for project_url can still just be removed. Projects that really want this feature can maybe put it directly in the notification email template?


Cheers,
Peter

Yeah, that seems right. I haven't looked through the discussion in the tickets you referenced, but I'll likely work on a documentation update after doing so. Thanks for investigating.

- Ryan

RjOllos

unread,
Apr 22, 2020, 4:15:19 PM4/22/20
to Trac Development

- Ryan 
Reply all
Reply to author
Forward
0 new messages