diff options
| author | bwarsaw | 2001-08-20 15:11:57 +0000 |
|---|---|---|
| committer | bwarsaw | 2001-08-20 15:11:57 +0000 |
| commit | f581d95289d180d54441fe163fa4ca510a99fc95 (patch) | |
| tree | 5980e529be0cc2d3bea543cc1ca47014ba97f8ad /Mailman/Cgi/create.py | |
| parent | 0ab9466f243627b7ffbe47d48ff7781c0771d2f7 (diff) | |
| download | mailman-f581d95289d180d54441fe163fa4ca510a99fc95.tar.gz mailman-f581d95289d180d54441fe163fa4ca510a99fc95.tar.zst mailman-f581d95289d180d54441fe163fa4ca510a99fc95.zip | |
process_request(): After the list is created, set the web_page_url and
host_name attributes based on the calculated values.
web_page_url's host name comes from get_domain() interpolated into
DEFAULT_URL_PATTERN, while host_name comes from a lookup in the
VIRTUAL_HOSTS table, defaulting to get_domain() if not found.
Also, we're now responsible for saving the list, and once we've
done so, we can unlock it and do the rest of the task (which
doesn't require the lock, so can be done outside the
try/finally).
Diffstat (limited to 'Mailman/Cgi/create.py')
| -rw-r--r-- | Mailman/Cgi/create.py | 96 |
1 files changed, 51 insertions, 45 deletions
diff --git a/Mailman/Cgi/create.py b/Mailman/Cgi/create.py index e76e514cd..359a41c4f 100644 --- a/Mailman/Cgi/create.py +++ b/Mailman/Cgi/create.py @@ -180,51 +180,12 @@ def process_request(doc, cgidata): Please contact the site administrator for assistance.''')) return - # Now do the MTA-specific list creation tasks - if mm_cfg.MTA: - modname = 'Mailman.MTA.' + mm_cfg.MTA - __import__(modname) - sys.modules[modname].create(mlist, cgi=1) - - # And send the notice to the list owner. - if notify: - siteadmin = Utils.get_site_email(mlist.host_name, '-admin') - text = Utils.maketext( - 'newlist.txt', - {'listname' : listname, - 'password' : password, - 'admin_url' : mlist.GetScriptURL('admin', absolute=1), - 'listinfo_url': mlist.GetScriptURL('listinfo', absolute=1), - 'requestaddr' : mlist.GetRequestEmail(), - 'siteowner' : siteadmin, - }, mlist=mlist) - msg = Message.UserNotification( - owner, siteadmin, - _('Your new mailing list: %(listname)s'), - text) - msg.send(mlist) - - # Success! - listinfo_url = mlist.GetScriptURL('listinfo', absolute=1) - admin_url = mlist.GetScriptURL('admin', absolute=1) - create_url = Utils.ScriptURL('create') - - title = _('Mailing list creation results') - doc.SetTitle(title) - table = Table(border=0, width='100%') - table.AddRow([Center(Bold(FontAttr(title, size='+1')))]) - table.AddCellInfo(table.GetCurrentRowIndex(), 0, - bgcolor=mm_cfg.WEB_HEADER_COLOR) - table.AddRow([_('''You have successfully created the mailing list - <b>%(listname)s</b> and notification has been sent to the list owner - <b>%(owner)s</b>. You can now:''')]) - ullist = UnorderedList() - ullist.AddItem(Link(listinfo_url, _("Visit the list's info page"))) - ullist.AddItem(Link(admin_url, _("Visit the list's admin page"))) - ullist.AddItem(Link(create_url, _('Create another list'))) - table.AddRow([ullist]) - doc.AddItem(table) - + # Initialize the host_name and web_page_url attributes, based on + # virtual hosting settings and the request environment variables. + hostname = Utils.get_domain() + mlist.web_page_url = mm_cfg.DEFAULT_URL_PATTERN % hostname + mlist.host_name = mm_cfg.VIRTUAL_HOSTS.get(hostname, hostname) + mlist.Save() finally: # Now be sure to unlock the list. It's okay if we get a signal here # because essentially, the signal handler will do the same thing. And @@ -232,6 +193,51 @@ def process_request(doc, cgidata): # we're already unlocked. mlist.Unlock() + # Now do the MTA-specific list creation tasks + if mm_cfg.MTA: + modname = 'Mailman.MTA.' + mm_cfg.MTA + __import__(modname) + sys.modules[modname].create(mlist, cgi=1) + + # And send the notice to the list owner. + if notify: + siteadmin = Utils.get_site_email(mlist.host_name, '-admin') + text = Utils.maketext( + 'newlist.txt', + {'listname' : listname, + 'password' : password, + 'admin_url' : mlist.GetScriptURL('admin', absolute=1), + 'listinfo_url': mlist.GetScriptURL('listinfo', absolute=1), + 'requestaddr' : mlist.GetRequestEmail(), + 'siteowner' : siteadmin, + }, mlist=mlist) + msg = Message.UserNotification( + owner, siteadmin, + _('Your new mailing list: %(listname)s'), + text) + msg.send(mlist) + + # Success! + listinfo_url = mlist.GetScriptURL('listinfo', absolute=1) + admin_url = mlist.GetScriptURL('admin', absolute=1) + create_url = Utils.ScriptURL('create') + + title = _('Mailing list creation results') + doc.SetTitle(title) + table = Table(border=0, width='100%') + table.AddRow([Center(Bold(FontAttr(title, size='+1')))]) + table.AddCellInfo(table.GetCurrentRowIndex(), 0, + bgcolor=mm_cfg.WEB_HEADER_COLOR) + table.AddRow([_('''You have successfully created the mailing list + <b>%(listname)s</b> and notification has been sent to the list owner + <b>%(owner)s</b>. You can now:''')]) + ullist = UnorderedList() + ullist.AddItem(Link(listinfo_url, _("Visit the list's info page"))) + ullist.AddItem(Link(admin_url, _("Visit the list's admin page"))) + ullist.AddItem(Link(create_url, _('Create another list'))) + table.AddRow([ullist]) + doc.AddItem(table) + # Because the cgi module blows |
