On 12/10/22 01:13, Odhiambo Washington wrote:
On Thu, Dec 8, 2022 at 10:41 PM Mark Sapiro <mark@msapiro.net> wrote:
In the DATABASES['default'] definition, you need to set
'OPTIONS': {'charset': 'utf8mb4'}
I added that:
[database] class: mailman.database.mysql.MySQLDatabase url: mysql+pymysql://mailman_user:XXXXXXXXX@localhost /mailmansuite?charset=utf8mb4&use_unicode=1
The above is for Mailman core. It doesn't affect HyperKitty. For that
you need to look at the DATABASES definition in
/etc/mailman3/settings.py
<https://docs.mailman3.org/projects/mailman-web/en/latest/settings.html#mailman_web.settings.base.DATABASES>
and ensure that in addition to the other settings under default {
you have
'OPTIONS': {'charset': 'utf8mb4'},
...
You might also need to modify the tables, particularly hyperkitty_email with something like
ALTER TABLE hyperkitty_email DEFAULT CHARACTER SET utf8mb4, MODIFY subject varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, MODIFY content CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
So I removed my list, dropped the database, and proceeded as follows:
create database mailmansuite CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci; ALTER TABLE hyperkitty_email DEFAULT CHARACTER SET utf8mb4; ALTER TABLE hyperkitty_email MODIFY subject varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ALTER TABLE hyperkitty_email MODIFY content longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ALTER TABLE hyperkitty_email MODIFY sender_name varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ALTER TABLE hyperkitty_email MODIFY in_reply_to varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
I did all those (although looks overzealous) just to be on the safe side. I have seen people putting emojis in their names.
None of that should be necessary. mailman-web migrate
should create
the database and tables as needed.
After that, I did the mailman-web migrate, created the list, imported the config from MM2 and then proceeded to import the archives. However, the errors still are there, and several messages were not imported
Do you have the OPTIONS setting in your DATABASES definition in settings.py?
...
Warming up cache Traceback (most recent call last): File "/opt/mailman/mm/venv/bin/django-admin", line 8, in <module> sys.exit(execute_from_command_line()) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line utility.execute() File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/core/management/__init__.py", line 440, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/core/management/base.py", line 402, in run_from_argv self.execute(*args, **cmd_options) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/core/management/base.py", line 448, in execute output = self.handle(*args, **options) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/hyperkitty/management/commands/hyperkitty_import.py", line 411, in handle call_command("hyperkitty_warm_up_cache", list_address) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/core/management/__init__.py", line 198, in call_command return command.execute(*args, **defaults) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/core/management/base.py", line 448, in execute output = self.handle(*args, **options) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/hyperkitty/management/commands/hyperkitty_warm_up_cache.py", line 53, in handle self.warm_up_mlist(mlist, options) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/hyperkitty/management/commands/hyperkitty_warm_up_cache.py", line 61, in warm_up_mlist for thread in mlist.recent_threads: File "/opt/mailman/mm/venv/lib/python3.9/site-packages/hyperkitty/models/mailinglist.py", line 162, in recent_threads return self.cached_values"recent_threads" File "/opt/mailman/mm/venv/lib/python3.9/site-packages/hyperkitty/models/common.py", line 58, in __call__ return self.get_or_set(*args, **kwargs) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/hyperkitty/models/mailinglist.py", line 317, in get_or_set return [Thread.objects.get(pk=pk) for pk in thread_ids] File "/opt/mailman/mm/venv/lib/python3.9/site-packages/hyperkitty/models/mailinglist.py", line 317, in <listcomp> return [Thread.objects.get(pk=pk) for pk in thread_ids] File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/db/models/manager.py", line 85, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/db/models/query.py", line 650, in get raise self.model.DoesNotExist( hyperkitty.models.thread.Thread.DoesNotExist: Thread matching query does not exist. (venv) [mailman@gw ~/mm]$
I have no idea what would cause this in a newly created database with no archives before running hyperkitty_import.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan