On 4/21/20 1:10 PM, Brian Carpenter wrote:
Ok. The first thing however is did I miss a step?
Not really. The problem is FILTER_VHOST = True doesn't work for web hosts that aren't email hosts.
Here is the complete error that is sent to me via email as superuser:
Internal Server Error:/mailman3/lists/
KeyError at/mailman3/lists/ 'file'
Traceback:
File "/opt/mailman/mm/venv/lib/python3.7/site-packages/django/core/handlers/exception.py" in inner 34. response = get_response(request)
File "/opt/mailman/mm/venv/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response 115. response = self.process_exception_by_middleware(e, request)
File "/opt/mailman/mm/venv/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response 113. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/opt/mailman/mm/venv/lib/python3.7/site-packages/postorius/views/list.py" in list_index 755. paginator_class=MailmanPaginator)
File "/opt/mailman/mm/venv/lib/python3.7/site-packages/django_mailman3/lib/paginator.py" in paginate 71. objects = paginator.page(page_num)
File "/opt/mailman/mm/venv/lib/python3.7/site-packages/django_mailman3/lib/paginator.py" in page 46. number = self.validate_number(number)
File "/opt/mailman/mm/venv/lib/python3.7/site-packages/django/core/paginator.py" in validate_number 48. if number > self.num_pages:
File "/opt/mailman/mm/venv/lib/python3.7/site-packages/django/utils/functional.py" in __get__ 80. res = instance.__dict__[self.name] = self.func(instance)
File "/opt/mailman/mm/venv/lib/python3.7/site-packages/django/core/paginator.py" in num_pages 97. if self.count == 0 and not self.allow_empty_first_page:
File "/opt/mailman/mm/venv/lib/python3.7/site-packages/django/utils/functional.py" in __get__ 80. res = instance.__dict__[self.name] = self.func(instance)
File "/opt/mailman/mm/venv/lib/python3.7/site-packages/django_mailman3/lib/paginator.py" in count 56. return self.function(count=0, page=1).total_size
File "/opt/mailman/mm/venv/lib/python3.7/site-packages/postorius/views/list.py" in _get_list_page 751. advertised=advertised, mail_host=mail_host, count=count, page=page)
File "/opt/mailman/mm/venv/lib/python3.7/site-packages/mailmanclient/client.py" in get_list_page 181. return Page(self._connection, url, MailingList, count, page)
File "/opt/mailman/mm/venv/lib/python3.7/site-packages/mailmanclient/restbase/page.py" in __init__ 37. self._create_page()
File "/opt/mailman/mm/venv/lib/python3.7/site-packages/mailmanclient/restbase/page.py" in _create_page 62. response, content = self._connection.call(self._build_url())
File "/opt/mailman/mm/venv/lib/python3.7/site-packages/mailmanclient/restbase/connection.py" in call 112. error_msg, response, None)
*During handling of the above exception (HTTP Error 404: {"title": "404 Not Found"}), another exception occurred:*
The above 404 is the underlying problem.
In the traceback above we see that /opt/mailman/mm/venv/lib/python3.7/site-packages/postorius/views/list.py at line 751 calls client to get the view for lists for this host.
The full code is
def _get_list_page(count, page): client = get_mailman_client() advertised = not request.user.is_superuser mail_host = request.get_host().split(":")[0] if ( getattr(settings, 'FILTER_VHOST', False)) else None return client.get_list_page( advertised=advertised, mail_host=mail_host, count=count, page=page)
The issue is the FILTER_VHOST = True setting is broken. This is <https://gitlab.com/mailman/postorius/-/issues/394>
The broken code tries to get the lists for the domain in the requesting URL which here is the web_host but the web_host has no lists.
This is a complicated issue. See the whole comment thread in the issue where I am trying to mentor someone to a fix, but he apparently has given up.
The issue is we don't have a method for retrieving lists by web host. It is simple enough to get all the email hosts associated with a web host, but what do we do if that's more than one email host.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan