mlist.script_url returns incorrect urls
Mailman core uses mlist.script_url to generate various URLs that should relate the the web UI, they are all incorrect for Postorius.
A side issue is that the URL is comprised of the base_url for the list. The docs suggest base_url would be along the lines of "https://list.example.com". This doesn't account for the sub URL of where Postorius is installed. Postorius_standalone uses "postorius/", Mailman-bundler uses "mailman3/" and the demo on Fedora uses "admin/". Either base_url will need to include the sub URL, or a separate parameter will be required. IMHO hard coding it to one value isn't a viable option.
Below are all the code references for script_url as of Mailman 3.0.0, along with details of whether the variable is used currently in a template.
app/notifications.py: listinfo_uri=mlist.script_url('listinfo'),
template: welcome_message, default=welcome.txt - variable is used
app/moderator.py: admindb_url=mlist.script_url('admindb'),
template: subauth.txt - variable not used
app/moderator.py: admindb_url=mlist.script_url('admindb'),
template: unsubauth.txt - variable is used
app/bounces.py: adminurl = mlist.script_url('admin') + '/bounce'
template: unrecognized.txt - variable is used
chains/hold.py: confirmurl = '{0}/{1}'.format(mlist.script_url('confirm'), token),
templates: postheld.txt & postauth.txt - variable is used in postheld.txt
chains/hold.py: admindb_url = mlist.script_url('admindb'),
templates: postheld.txt & postauth.txt - variable not used
commands/cli_lists.py: admin_url = mlist.script_url('admin'),
template: newlist.txt - variable is used
commands/cli_lists.py: listinfo_url = mlist.script_url('listinfo'),
template: newlist.txt - variable is used
handlers/decorate.py: listinfo_uri = mlist.script_url('listinfo'),
all templates processed through decorate_template function
..^ called by utilities/importer.py import_config_pck function
....^ called by commands/cli_import.py Import21:process function
handlers/acknowledge.py: listinfo_url=mlist.script_url('listinfo'),
template: postack.txt - variable is used
handlers/replybot.py: listurl = mlist.script_url('listinfo'),
autoresponse test substitution
handlers/rfc_2369.py: listinfo = mlist.script_url('listinfo')
headers: List-Subscribe & List-Unsubscribe
runners/digest.py: got_listinfo_url=mlist.script_url('listinfo'),
template: masthead.txt - variable is used
As a workaround to at least not have user facing emails being sent with dead links, I've patched my install for just "listinfo" with the following:
diff -Naur a/model/mailinglist.py b/model/mailinglist.py
--- a/model/mailinglist.py 2015-05-23 20:52:27.895456000 +0100
+++ b/model/mailinglist.py 2015-05-23 20:55:18.243456000 +0100
@@ -256,6 +256,8 @@
"""See `IMailingList`."""
# XXX Handle the case for when context is not None; those would be
# relative URLs.
+ if target == "listinfo":
+ target = "mailman3/lists"
return urljoin(self.domain.base_url, target + '/' + self.fqdn_listname)
@property
As mentioned earlier, hard coding mailman3 isn't ideal.
Note to anyone using the above workaround. You might also want to customize postheld.txt to remove the confirm URL and also check out #110 (closed) for welcome.txt.