I am not sure when this last worked, it has been a while since upgrading py4web. Upon trying to use auth/request_reset_password, got a 500 error. The key lines from the stack trace are below:
File "/home/hm/prod/lib/python3.12/site-packages/py4web/utils/mailer.py", line 391, in send
add_charset("utf-8", charset_QP, charset_QP, "utf-8")
^^^^^^^^^^^
NameError: name 'add_charset' is not defined
Looks like add_charset is in email.charset, so in mailer.py, added the line "from email.charset import add_charset" just before the add_charset line. This resulted in the following:
File "/home/hm/prod/lib/python3.12/site-packages/py4web/utils/mailer.py", line 392, in send
add_charset("utf-8", charset_QP, charset_QP, "utf-8")
^^^^^^^^^^
NameError: name 'charset_QP' is not defined
Took some digging to find that there's an import in pydal that seems relevant. Adding the line "from email.charset import QP as charset_QP" just before the add_charset line worked. Not sure if this is the "correct" fix but I'm up and running now.
mailer.py now changed from line 391:
add_charset("utf-8", charset_QP, charset_QP, "utf-8")
to lines 391-393:
from email.charset import add_charset
from email.charset import QP as charset_QP
add_charset("utf-8", charset_QP, charset_QP, "utf-8")